Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:29:57

0001 /*
0002  * GL2PS, an OpenGL to PostScript Printing Library
0003  * Copyright (C) 1999-2020 C. Geuzaine
0004  *
0005  * This program is free software; you can redistribute it and/or
0006  * modify it under the terms of either:
0007  *
0008  * a) the GNU Library General Public License as published by the Free
0009  * Software Foundation, either version 2 of the License, or (at your
0010  * option) any later version; or
0011  *
0012  * b) the GL2PS License as published by Christophe Geuzaine, either
0013  * version 2 of the License, or (at your option) any later version.
0014  *
0015  * This program is distributed in the hope that it will be useful, but
0016  * WITHOUT ANY WARRANTY; without even the implied warranty of
0017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
0018  * the GNU Library General Public License or the GL2PS License for
0019  * more details.
0020  *
0021  * You should have received a copy of the GNU Library General Public
0022  * License along with this library in the file named "COPYING.LGPL";
0023  * if not, write to the Free Software Foundation, Inc., 51 Franklin
0024  * Street, Fifth Floor, Boston, MA 02110-1301, USA.
0025  *
0026  * You should have received a copy of the GL2PS License with this
0027  * library in the file named "COPYING.GL2PS"; if not, I will be glad
0028  * to provide one.
0029  *
0030  * For the latest info about gl2ps and a full list of contributors,
0031  * see http://www.geuz.org/gl2ps/.
0032  *
0033  * Please report all bugs and problems to <gl2ps@geuz.org>.
0034  */
0035 
0036 #ifndef GL2PS_H
0037 #define GL2PS_H
0038 
0039 #include <stdio.h>
0040 #include <stdlib.h>
0041 
0042 /* Define GL2PSDLL at compile time to build a Windows DLL */
0043 
0044 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
0045 #  if defined(_MSC_VER)
0046 #    pragma warning(disable:4115)
0047 #    pragma warning(disable:4127)
0048 #    pragma warning(disable:4996)
0049 #  endif
0050 #  if !defined(NOMINMAX)
0051 #    define NOMINMAX
0052 #  endif
0053 #  include <windows.h>
0054 #  undef NOMINMAX
0055 #  if defined(GL2PSDLL)
0056 #    if defined(GL2PSDLL_EXPORTS)
0057 #      define GL2PSDLL_API __declspec(dllexport)
0058 #    else
0059 #      define GL2PSDLL_API __declspec(dllimport)
0060 #    endif
0061 #  else
0062 #    define GL2PSDLL_API
0063 #  endif
0064 #else
0065 #  define GL2PSDLL_API
0066 #endif
0067 
0068 #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
0069 #  include <OpenGL/gl.h>
0070 #else
0071 #  include <GL/gl.h>
0072 #endif
0073 
0074 /* Support for compressed PostScript/PDF/SVG and for embedded PNG
0075    images in SVG */
0076 
0077 #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
0078 #  define GL2PS_HAVE_ZLIB
0079 #  if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
0080 #    define GL2PS_HAVE_LIBPNG
0081 #  endif
0082 #endif
0083 
0084 #if defined(HAVE_NO_VSNPRINTF)
0085 #  define GL2PS_HAVE_NO_VSNPRINTF
0086 #endif
0087 
0088 /* Version number */
0089 
0090 #define GL2PS_MAJOR_VERSION 1
0091 #define GL2PS_MINOR_VERSION 4
0092 #define GL2PS_PATCH_VERSION 2
0093 #define GL2PS_EXTRA_VERSION ""
0094 
0095 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
0096                        0.01 * GL2PS_MINOR_VERSION + \
0097                        0.0001 * GL2PS_PATCH_VERSION)
0098 
0099 #define GL2PS_COPYRIGHT "(C) 1999-2020 C. Geuzaine"
0100 
0101 /* Output file formats (the values and the ordering are important!) */
0102 
0103 #define GL2PS_PS  0
0104 #define GL2PS_EPS 1
0105 #define GL2PS_TEX 2
0106 #define GL2PS_PDF 3
0107 #define GL2PS_SVG 4
0108 #define GL2PS_PGF 5
0109 
0110 /* Sorting algorithms */
0111 
0112 #define GL2PS_NO_SORT     1
0113 #define GL2PS_SIMPLE_SORT 2
0114 #define GL2PS_BSP_SORT    3
0115 
0116 /* Message levels and error codes */
0117 
0118 #define GL2PS_SUCCESS       0
0119 #define GL2PS_INFO          1
0120 #define GL2PS_WARNING       2
0121 #define GL2PS_ERROR         3
0122 #define GL2PS_NO_FEEDBACK   4
0123 #define GL2PS_OVERFLOW      5
0124 #define GL2PS_UNINITIALIZED 6
0125 
0126 /* Options for gl2psBeginPage */
0127 
0128 #define GL2PS_NONE                 0
0129 #define GL2PS_DRAW_BACKGROUND      (1<<0)
0130 #define GL2PS_SIMPLE_LINE_OFFSET   (1<<1)
0131 #define GL2PS_SILENT               (1<<2)
0132 #define GL2PS_BEST_ROOT            (1<<3)
0133 #define GL2PS_OCCLUSION_CULL       (1<<4)
0134 #define GL2PS_NO_TEXT              (1<<5)
0135 #define GL2PS_LANDSCAPE            (1<<6)
0136 #define GL2PS_NO_PS3_SHADING       (1<<7)
0137 #define GL2PS_NO_PIXMAP            (1<<8)
0138 #define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
0139 #define GL2PS_COMPRESS             (1<<10)
0140 #define GL2PS_NO_BLENDING          (1<<11)
0141 #define GL2PS_TIGHT_BOUNDING_BOX   (1<<12)
0142 #define GL2PS_NO_OPENGL_CONTEXT    (1<<13)
0143 #define GL2PS_NO_TEX_FONTSIZE      (1<<14)
0144 
0145 /* Arguments for gl2psEnable/gl2psDisable */
0146 
0147 #define GL2PS_POLYGON_OFFSET_FILL 1
0148 #define GL2PS_POLYGON_BOUNDARY    2
0149 #define GL2PS_LINE_STIPPLE        3
0150 #define GL2PS_BLEND               4
0151 
0152 /* Arguments for gl2psLineCap/Join */
0153 
0154 #define GL2PS_LINE_CAP_BUTT       0
0155 #define GL2PS_LINE_CAP_ROUND      1
0156 #define GL2PS_LINE_CAP_SQUARE     2
0157 
0158 #define GL2PS_LINE_JOIN_MITER     0
0159 #define GL2PS_LINE_JOIN_ROUND     1
0160 #define GL2PS_LINE_JOIN_BEVEL     2
0161 
0162 /* Text alignment (o=raster position; default mode is BL):
0163    +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
0164    | o | o   | |   o |   | |   | |   | |   | |   | |   |
0165    +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
0166     C     CL    CR    B     BL    BR    T     TL    TR */
0167 
0168 #define GL2PS_TEXT_C  1
0169 #define GL2PS_TEXT_CL 2
0170 #define GL2PS_TEXT_CR 3
0171 #define GL2PS_TEXT_B  4
0172 #define GL2PS_TEXT_BL 5
0173 #define GL2PS_TEXT_BR 6
0174 #define GL2PS_TEXT_T  7
0175 #define GL2PS_TEXT_TL 8
0176 #define GL2PS_TEXT_TR 9
0177 
0178 typedef GLfloat GL2PSrgba[4];
0179 typedef GLfloat GL2PSxyz[3];
0180 
0181 typedef struct {
0182   GL2PSxyz xyz;
0183   GL2PSrgba rgba;
0184 } GL2PSvertex;
0185 
0186 /* Primitive types */
0187 #define GL2PS_NO_TYPE          -1
0188 #define GL2PS_TEXT             1
0189 #define GL2PS_POINT            2
0190 #define GL2PS_LINE             3
0191 #define GL2PS_QUADRANGLE       4
0192 #define GL2PS_TRIANGLE         5
0193 #define GL2PS_PIXMAP           6
0194 #define GL2PS_IMAGEMAP         7
0195 #define GL2PS_IMAGEMAP_WRITTEN 8
0196 #define GL2PS_IMAGEMAP_VISIBLE 9
0197 #define GL2PS_SPECIAL          10
0198 
0199 #if defined(__cplusplus)
0200 extern "C" {
0201 #endif
0202 
0203 GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
0204                                   GLint viewport[4], GLint format, GLint sort,
0205                                   GLint options, GLint colormode,
0206                                   GLint colorsize, GL2PSrgba *colormap,
0207                                   GLint nr, GLint ng, GLint nb, GLint buffersize,
0208                                   FILE *stream, const char *filename);
0209 GL2PSDLL_API GLint gl2psEndPage(void);
0210 GL2PSDLL_API GLint gl2psSetOptions(GLint options);
0211 GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
0212 GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
0213 GL2PSDLL_API GLint gl2psEndViewport(void);
0214 GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
0215                              GLshort fontsize);
0216 GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
0217                                 GLshort fontsize, GLint align, GLfloat angle);
0218 GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname,
0219                                      GLshort fontsize, GLint align, GLfloat angle,
0220                                      GL2PSrgba color);
0221 GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname,
0222                                        GLshort fontsize, GLint align, GLfloat angle,
0223                                        GL2PSrgba color, GLfloat blx, GLfloat bly);
0224 GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
0225 GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba);
0226 GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
0227                                    GLint xorig, GLint yorig,
0228                                    GLenum format, GLenum type, const void *pixels);
0229 GL2PSDLL_API GLint gl2psEnable(GLint mode);
0230 GL2PSDLL_API GLint gl2psDisable(GLint mode);
0231 GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
0232 GL2PSDLL_API GLint gl2psLineCap(GLint value);
0233 GL2PSDLL_API GLint gl2psLineJoin(GLint value);
0234 GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
0235 GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
0236 GL2PSDLL_API GLint gl2psSorting(GLint mode);
0237 
0238 /* referenced in the documentation, but not fully documented */
0239 GL2PSDLL_API GLint gl2psForceRasterPos(GL2PSvertex *vert);
0240 GL2PSDLL_API void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
0241                                         GL2PSvertex *verts, GLint offset,
0242                                         GLfloat ofactor, GLfloat ounits,
0243                                         GLushort pattern, GLint factor,
0244                                         GLfloat width, GLint linecap,
0245                                         GLint linejoin, char boundary);
0246 
0247 /* undocumented */
0248 GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
0249                                      const GLfloat position[3],
0250                                      const unsigned char *imagemap);
0251 GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
0252 GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
0253 GL2PSDLL_API GLint gl2psGetFileFormat();
0254 GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling);
0255 
0256 #if defined(__cplusplus)
0257 }
0258 #endif
0259 
0260 #endif