CMS 3D CMS Logo

gl2ps.h

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

Generated on Tue Jun 9 17:38:30 2009 for CMSSW by  doxygen 1.5.4