ROOT  6.06/09
Reference Guide
gl2ps.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 /*
3  * GL2PS, an OpenGL to PostScript Printing Library
4  * Copyright (C) 1999-2009 C. Geuzaine
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of either:
8  *
9  * a) the GNU Library General Public License as published by the Free
10  * Software Foundation, either version 2 of the License, or (at your
11  * option) any later version; or
12  *
13  * b) the GL2PS License as published by Christophe Geuzaine, either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
19  * the GNU Library General Public License or the GL2PS License for
20  * more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library in the file named "COPYING.LGPL";
24  * if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
25  * Cambridge, MA 02139, USA.
26  *
27  * You should have received a copy of the GL2PS License with this
28  * library in the file named "COPYING.GL2PS"; if not, I will be glad
29  * to provide one.
30  *
31  * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
32  * Please report all bugs and problems to <gl2ps@geuz.org>.
33  */
34 
35 #ifndef __GL2PS_H__
36 #define __GL2PS_H__
37 
38 #include <stdio.h>
39 #include <stdlib.h>
40 
41 #include <TGLIncludes.h>
42 
43 #define GL2PSDLL_API
44 
45 /* Support for compressed PostScript/PDF/SVG and for embedded PNG
46  images in SVG */
47 
48 #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
49 # define GL2PS_HAVE_ZLIB
50 # if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
51 # define GL2PS_HAVE_LIBPNG
52 # endif
53 #endif
54 
55 /* Version number */
56 
57 #define GL2PS_MAJOR_VERSION 1
58 #define GL2PS_MINOR_VERSION 3
59 #define GL2PS_PATCH_VERSION 3
60 #define GL2PS_EXTRA_VERSION ""
61 
62 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
63  0.01 * GL2PS_MINOR_VERSION + \
64  0.0001 * GL2PS_PATCH_VERSION)
65 
66 #define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine"
67 
68 /* Output file formats (the values and the ordering are important!) */
69 
70 #define GL2PS_PS 0
71 #define GL2PS_EPS 1
72 #define GL2PS_TEX 2
73 #define GL2PS_PDF 3
74 #define GL2PS_SVG 4
75 #define GL2PS_PGF 5
76 
77 /* Sorting algorithms */
78 
79 #define GL2PS_NO_SORT 1
80 #define GL2PS_SIMPLE_SORT 2
81 #define GL2PS_BSP_SORT 3
82 
83 /* Message levels and error codes */
84 
85 #define GL2PS_SUCCESS 0
86 #define GL2PS_INFO 1
87 #define GL2PS_WARNING 2
88 #define GL2PS_ERROR 3
89 #define GL2PS_NO_FEEDBACK 4
90 #define GL2PS_OVERFLOW 5
91 #define GL2PS_UNINITIALIZED 6
92 
93 /* Options for gl2psBeginPage */
94 
95 #define GL2PS_NONE 0
96 #define GL2PS_DRAW_BACKGROUND (1<<0)
97 #define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
98 #define GL2PS_SILENT (1<<2)
99 #define GL2PS_BEST_ROOT (1<<3)
100 #define GL2PS_OCCLUSION_CULL (1<<4)
101 #define GL2PS_NO_TEXT (1<<5)
102 #define GL2PS_LANDSCAPE (1<<6)
103 #define GL2PS_NO_PS3_SHADING (1<<7)
104 #define GL2PS_NO_PIXMAP (1<<8)
105 #define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
106 #define GL2PS_COMPRESS (1<<10)
107 #define GL2PS_NO_BLENDING (1<<11)
108 #define GL2PS_TIGHT_BOUNDING_BOX (1<<12)
109 
110 /* Arguments for gl2psEnable/gl2psDisable */
111 
112 #define GL2PS_POLYGON_OFFSET_FILL 1
113 #define GL2PS_POLYGON_BOUNDARY 2
114 #define GL2PS_LINE_STIPPLE 3
115 #define GL2PS_BLEND 4
116 
117 /* Text alignment (o=raster position; default mode is BL):
118  +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
119  | o | o | | o | | | | | | | | | | | |
120  +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
121  C CL CR B BL BR T TL TR */
122 
123 #define GL2PS_TEXT_C 1
124 #define GL2PS_TEXT_CL 2
125 #define GL2PS_TEXT_CR 3
126 #define GL2PS_TEXT_B 4
127 #define GL2PS_TEXT_BL 5
128 #define GL2PS_TEXT_BR 6
129 #define GL2PS_TEXT_T 7
130 #define GL2PS_TEXT_TL 8
131 #define GL2PS_TEXT_TR 9
132 
133 typedef GLfloat GL2PSrgba[4];
134 
135 #if defined(__cplusplus)
136 extern "C" {
137 #endif
138 
139 GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
140  GLint viewport[4], GLint format, GLint sort,
141  GLint options, GLint colormode,
142  GLint colorsize, GL2PSrgba *colormap,
143  GLint nr, GLint ng, GLint nb, GLint buffersize,
144  FILE *stream, const char *filename);
145 GL2PSDLL_API GLint gl2psEndPage(void);
146 GL2PSDLL_API GLint gl2psSetOptions(GLint options);
147 GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
148 GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
149 GL2PSDLL_API GLint gl2psEndViewport(void);
150 GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
151  GLshort fontsize);
152 GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
153  GLshort fontsize, GLint align, GLfloat angle);
154 GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
155 GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
156  GLint xorig, GLint yorig,
157  GLenum format, GLenum type, const void *pixels);
158 GL2PSDLL_API GLint gl2psEnable(GLint mode);
159 GL2PSDLL_API GLint gl2psDisable(GLint mode);
160 GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
161 GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
162 GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
163 
164 /* undocumented */
165 GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
166  const GLfloat position[3],
167  const unsigned char *imagemap);
168 GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
169 GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
170 
171 #if defined(__cplusplus)
172 }
173 #endif
174 
175 #endif /* __GL2PS_H__ */
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels)
Definition: gl2ps.cxx:5799
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename)
Definition: gl2ps.cxx:5566
GLfloat GL2PSrgba[4]
Definition: gl2ps.h:133
static const char * filename()
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4])
Definition: gl2ps.cxx:5760
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize)
Definition: gl2ps.cxx:5789
GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor)
Definition: gl2ps.cxx:5983
static std::string format(double x, double y, int digits, int width)
GL2PSDLL_API GLint gl2psGetOptions(GLint *options)
Definition: gl2ps.cxx:6007
GL2PSDLL_API GLint gl2psEndViewport(void)
Definition: gl2ps.cxx:5769
GL2PSDLL_API const char * gl2psGetFileExtension(GLint format)
Definition: gl2ps.cxx:6019
GL2PSDLL_API GLint gl2psDisable(GLint mode)
Definition: gl2ps.cxx:5938
GL2PSDLL_API GLint gl2psSetOptions(GLint options)
Definition: gl2ps.cxx:5998
GL2PSDLL_API GLint gl2psEndPage(void)
Definition: gl2ps.cxx:5733
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle)
Definition: gl2ps.cxx:5783
GL2PSDLL_API GLint gl2psPointSize(GLfloat value)
Definition: gl2ps.cxx:5963
GL2PSDLL_API const char * gl2psGetFormatDescription(GLint format)
Definition: gl2ps.cxx:6027
int type
Definition: TGX11.cxx:120
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value)
Definition: gl2ps.cxx:5973
#define GL2PSDLL_API
Definition: gl2ps.h:43
GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, const GLfloat position[3], const unsigned char *imagemap)
Definition: gl2ps.cxx:5880
float value
Definition: math.cpp:443
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str)
Definition: gl2ps.cxx:5794
GL2PSDLL_API GLint gl2psEnable(GLint mode)
Definition: gl2ps.cxx:5905