gl2ps.h

Go to the documentation of this file.
00001 /*
00002  * GL2PS, an OpenGL to PostScript Printing Library
00003  * Copyright (C) 1999-2011 C. Geuzaine
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of either:
00007  *
00008  * a) the GNU Library General Public License as published by the Free
00009  * Software Foundation, either version 2 of the License, or (at your
00010  * option) any later version; or
00011  *
00012  * b) the GL2PS License as published by Christophe Geuzaine, either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
00018  * the GNU Library General Public License or the GL2PS License for
00019  * more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this library in the file named "COPYING.LGPL";
00023  * if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
00024  * Cambridge, MA 02139, USA.
00025  *
00026  * You should have received a copy of the GL2PS License with this
00027  * library in the file named "COPYING.GL2PS"; if not, I will be glad
00028  * to provide one.
00029  *
00030  * For the latest info about gl2ps and a full list of contributors,
00031  * see http://www.geuz.org/gl2ps/.
00032  *
00033  * Please report all bugs and problems to <gl2ps@geuz.org>.
00034  */
00035 
00036 #ifndef __GL2PS_H__
00037 #define __GL2PS_H__
00038 
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041 
00042 /* Define GL2PSDLL at compile time to build a Windows DLL */
00043 
00044 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
00045 #  if defined(_MSC_VER)
00046 #    pragma warning(disable:4115)
00047 #    pragma warning(disable:4996)
00048 #  endif
00049 #  define WIN32_LEAN_AND_MEAN
00050 #  include <windows.h>
00051 #  if defined(GL2PSDLL)
00052 #    if defined(GL2PSDLL_EXPORTS)
00053 #      define GL2PSDLL_API __declspec(dllexport)
00054 #    else
00055 #      define GL2PSDLL_API __declspec(dllimport)
00056 #    endif
00057 #  else
00058 #    define GL2PSDLL_API
00059 #  endif
00060 #else
00061 #  define GL2PSDLL_API
00062 #endif
00063 
00064 #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
00065 #  include <OpenGL/gl.h>
00066 #else
00067 #  include <GL/gl.h>
00068 #endif
00069 
00070 /* Support for compressed PostScript/PDF/SVG and for embedded PNG
00071    images in SVG */
00072 
00073 #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
00074 #  define GL2PS_HAVE_ZLIB
00075 #  if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
00076 #    define GL2PS_HAVE_LIBPNG
00077 #  endif
00078 #endif
00079 
00080 /* Version number */
00081 
00082 #define GL2PS_MAJOR_VERSION 1
00083 #define GL2PS_MINOR_VERSION 3
00084 #define GL2PS_PATCH_VERSION 6
00085 #define GL2PS_EXTRA_VERSION ""
00086 
00087 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
00088                        0.01 * GL2PS_MINOR_VERSION + \
00089                        0.0001 * GL2PS_PATCH_VERSION)
00090 
00091 #define GL2PS_COPYRIGHT "(C) 1999-2011 C. Geuzaine"
00092 
00093 /* Output file formats (the values and the ordering are important!) */
00094 
00095 #define GL2PS_PS  0
00096 #define GL2PS_EPS 1
00097 #define GL2PS_TEX 2
00098 #define GL2PS_PDF 3
00099 #define GL2PS_SVG 4
00100 #define GL2PS_PGF 5
00101 
00102 /* Sorting algorithms */
00103 
00104 #define GL2PS_NO_SORT     1
00105 #define GL2PS_SIMPLE_SORT 2
00106 #define GL2PS_BSP_SORT    3
00107 
00108 /* Message levels and error codes */
00109 
00110 #define GL2PS_SUCCESS       0
00111 #define GL2PS_INFO          1
00112 #define GL2PS_WARNING       2
00113 #define GL2PS_ERROR         3
00114 #define GL2PS_NO_FEEDBACK   4
00115 #define GL2PS_OVERFLOW      5
00116 #define GL2PS_UNINITIALIZED 6
00117 
00118 /* Options for gl2psBeginPage */
00119 
00120 #define GL2PS_NONE                 0
00121 #define GL2PS_DRAW_BACKGROUND      (1<<0)
00122 #define GL2PS_SIMPLE_LINE_OFFSET   (1<<1)
00123 #define GL2PS_SILENT               (1<<2)
00124 #define GL2PS_BEST_ROOT            (1<<3)
00125 #define GL2PS_OCCLUSION_CULL       (1<<4)
00126 #define GL2PS_NO_TEXT              (1<<5)
00127 #define GL2PS_LANDSCAPE            (1<<6)
00128 #define GL2PS_NO_PS3_SHADING       (1<<7)
00129 #define GL2PS_NO_PIXMAP            (1<<8)
00130 #define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
00131 #define GL2PS_COMPRESS             (1<<10)
00132 #define GL2PS_NO_BLENDING          (1<<11)
00133 #define GL2PS_TIGHT_BOUNDING_BOX   (1<<12)
00134 
00135 /* Arguments for gl2psEnable/gl2psDisable */
00136 
00137 #define GL2PS_POLYGON_OFFSET_FILL 1
00138 #define GL2PS_POLYGON_BOUNDARY    2
00139 #define GL2PS_LINE_STIPPLE        3
00140 #define GL2PS_BLEND               4
00141 
00142 /* Text alignment (o=raster position; default mode is BL):
00143    +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
00144    | o | o   | |   o |   | |   | |   | |   | |   | |   |
00145    +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
00146     C     CL    CR    B     BL    BR    T     TL    TR */
00147 
00148 #define GL2PS_TEXT_C  1
00149 #define GL2PS_TEXT_CL 2
00150 #define GL2PS_TEXT_CR 3
00151 #define GL2PS_TEXT_B  4
00152 #define GL2PS_TEXT_BL 5
00153 #define GL2PS_TEXT_BR 6
00154 #define GL2PS_TEXT_T  7
00155 #define GL2PS_TEXT_TL 8
00156 #define GL2PS_TEXT_TR 9
00157 
00158 typedef GLfloat GL2PSrgba[4];
00159 
00160 #if defined(__cplusplus)
00161 extern "C" {
00162 #endif
00163 
00164 GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
00165                                   GLint viewport[4], GLint format, GLint sort,
00166                                   GLint options, GLint colormode,
00167                                   GLint colorsize, GL2PSrgba *colormap,
00168                                   GLint nr, GLint ng, GLint nb, GLint buffersize,
00169                                   FILE *stream, const char *filename);
00170 GL2PSDLL_API GLint gl2psEndPage(void);
00171 GL2PSDLL_API GLint gl2psSetOptions(GLint options);
00172 GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
00173 GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
00174 GL2PSDLL_API GLint gl2psEndViewport(void);
00175 GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
00176                              GLshort fontsize);
00177 GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
00178                                 GLshort fontsize, GLint align, GLfloat angle);
00179 GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
00180 GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
00181                                    GLint xorig, GLint yorig,
00182                                    GLenum format, GLenum type, const void *pixels);
00183 GL2PSDLL_API GLint gl2psEnable(GLint mode);
00184 GL2PSDLL_API GLint gl2psDisable(GLint mode);
00185 GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
00186 GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
00187 GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
00188 
00189 /* undocumented */
00190 GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
00191                                      const GLfloat position[3],
00192                                      const unsigned char *imagemap);
00193 GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
00194 GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
00195 
00196 #if defined(__cplusplus)
00197 }
00198 #endif
00199 
00200 #endif /* __GL2PS_H__ */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines