ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gl2ps.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file gl2ps.h
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 /*
28  * GL2PS, an OpenGL to PostScript Printing Library
29  * Copyright (C) 1999-2017 C. Geuzaine
30  *
31  * This program is free software; you can redistribute it and/or
32  * modify it under the terms of either:
33  *
34  * a) the GNU Library General Public License as published by the Free
35  * Software Foundation, either version 2 of the License, or (at your
36  * option) any later version; or
37  *
38  * b) the GL2PS License as published by Christophe Geuzaine, either
39  * version 2 of the License, or (at your option) any later version.
40  *
41  * This program is distributed in the hope that it will be useful, but
42  * WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
44  * the GNU Library General Public License or the GL2PS License for
45  * more details.
46  *
47  * You should have received a copy of the GNU Library General Public
48  * License along with this library in the file named "COPYING.LGPL";
49  * if not, write to the Free Software Foundation, Inc., 51 Franklin
50  * Street, Fifth Floor, Boston, MA 02110-1301, USA.
51  *
52  * You should have received a copy of the GL2PS License with this
53  * library in the file named "COPYING.GL2PS"; if not, I will be glad
54  * to provide one.
55  *
56  * For the latest info about gl2ps and a full list of contributors,
57  * see http://www.geuz.org/gl2ps/.
58  *
59  * Please report all bugs and problems to <gl2ps@geuz.org>.
60  */
61 
62 #ifndef __GL2PS_H__
63 #define __GL2PS_H__
64 
65 #include <stdio.h>
66 #include <stdlib.h>
67 
68 /* Define GL2PSDLL at compile time to build a Windows DLL */
69 
70 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
71 # if defined(_MSC_VER)
72 # pragma warning(disable:4115)
73 # pragma warning(disable:4127)
74 # pragma warning(disable:4996)
75 # endif
76 # define NOMINMAX
77 # include <windows.h>
78 # undef NOMINMAX
79 # if defined(GL2PSDLL)
80 # if defined(GL2PSDLL_EXPORTS)
81 # define GL2PSDLL_API __declspec(dllexport)
82 # else
83 # define GL2PSDLL_API __declspec(dllimport)
84 # endif
85 # else
86 # define GL2PSDLL_API
87 # endif
88 #else
89 # define GL2PSDLL_API
90 #endif
91 
92 #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
93 # include <OpenGL/gl.h>
94 #else
95 # include <GL/gl.h>
96 #endif
97 
98 /* Support for compressed PostScript/PDF/SVG and for embedded PNG
99  images in SVG */
100 
101 #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
102 # define GL2PS_HAVE_ZLIB
103 # if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
104 # define GL2PS_HAVE_LIBPNG
105 # endif
106 #endif
107 
108 #if defined(HAVE_NO_VSNPRINTF)
109 # define GL2PS_HAVE_NO_VSNPRINTF
110 #endif
111 
112 /* Version number */
113 
114 #define GL2PS_MAJOR_VERSION 1
115 #define GL2PS_MINOR_VERSION 4
116 #define GL2PS_PATCH_VERSION 0
117 #define GL2PS_EXTRA_VERSION ""
118 
119 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
120  0.01 * GL2PS_MINOR_VERSION + \
121  0.0001 * GL2PS_PATCH_VERSION)
122 
123 #define GL2PS_COPYRIGHT "(C) 1999-2017 C. Geuzaine"
124 
125 /* Output file formats (the values and the ordering are important!) */
126 
127 #define GL2PS_PS 0
128 #define GL2PS_EPS 1
129 #define GL2PS_TEX 2
130 #define GL2PS_PDF 3
131 #define GL2PS_SVG 4
132 #define GL2PS_PGF 5
133 
134 /* Sorting algorithms */
135 
136 #define GL2PS_NO_SORT 1
137 #define GL2PS_SIMPLE_SORT 2
138 #define GL2PS_BSP_SORT 3
139 
140 /* Message levels and error codes */
141 
142 #define GL2PS_SUCCESS 0
143 #define GL2PS_INFO 1
144 #define GL2PS_WARNING 2
145 #define GL2PS_ERROR 3
146 #define GL2PS_NO_FEEDBACK 4
147 #define GL2PS_OVERFLOW 5
148 #define GL2PS_UNINITIALIZED 6
149 
150 /* Options for gl2psBeginPage */
151 
152 #define GL2PS_NONE 0
153 #define GL2PS_DRAW_BACKGROUND (1<<0)
154 #define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
155 #define GL2PS_SILENT (1<<2)
156 #define GL2PS_BEST_ROOT (1<<3)
157 #define GL2PS_OCCLUSION_CULL (1<<4)
158 #define GL2PS_NO_TEXT (1<<5)
159 #define GL2PS_LANDSCAPE (1<<6)
160 #define GL2PS_NO_PS3_SHADING (1<<7)
161 #define GL2PS_NO_PIXMAP (1<<8)
162 #define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
163 #define GL2PS_COMPRESS (1<<10)
164 #define GL2PS_NO_BLENDING (1<<11)
165 #define GL2PS_TIGHT_BOUNDING_BOX (1<<12)
166 #define GL2PS_NO_OPENGL_CONTEXT (1<<13)
167 
168 /* Arguments for gl2psEnable/gl2psDisable */
169 
170 #define GL2PS_POLYGON_OFFSET_FILL 1
171 #define GL2PS_POLYGON_BOUNDARY 2
172 #define GL2PS_LINE_STIPPLE 3
173 #define GL2PS_BLEND 4
174 
175 
176 /* Arguments for gl2psLineCap/Join */
177 
178 #define GL2PS_LINE_CAP_BUTT 0
179 #define GL2PS_LINE_CAP_ROUND 1
180 #define GL2PS_LINE_CAP_SQUARE 2
181 
182 #define GL2PS_LINE_JOIN_MITER 0
183 #define GL2PS_LINE_JOIN_ROUND 1
184 #define GL2PS_LINE_JOIN_BEVEL 2
185 
186 /* Text alignment (o=raster position; default mode is BL):
187  +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
188  | o | o | | o | | | | | | | | | | | |
189  +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
190  C CL CR B BL BR T TL TR */
191 
192 #define GL2PS_TEXT_C 1
193 #define GL2PS_TEXT_CL 2
194 #define GL2PS_TEXT_CR 3
195 #define GL2PS_TEXT_B 4
196 #define GL2PS_TEXT_BL 5
197 #define GL2PS_TEXT_BR 6
198 #define GL2PS_TEXT_T 7
199 #define GL2PS_TEXT_TL 8
200 #define GL2PS_TEXT_TR 9
201 
202 typedef GLfloat GL2PSrgba[4];
203 typedef GLfloat GL2PSxyz[3];
204 
205 typedef struct {
208 } GL2PSvertex;
209 
210 /* Primitive types */
211 #define GL2PS_NO_TYPE -1
212 #define GL2PS_TEXT 1
213 #define GL2PS_POINT 2
214 #define GL2PS_LINE 3
215 #define GL2PS_QUADRANGLE 4
216 #define GL2PS_TRIANGLE 5
217 #define GL2PS_PIXMAP 6
218 #define GL2PS_IMAGEMAP 7
219 #define GL2PS_IMAGEMAP_WRITTEN 8
220 #define GL2PS_IMAGEMAP_VISIBLE 9
221 #define GL2PS_SPECIAL 10
222 
223 #if defined(__cplusplus)
224 extern "C" {
225 #endif
226 
227 GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
228  GLint viewport[4], GLint format, GLint sort,
229  GLint options, GLint colormode,
230  GLint colorsize, GL2PSrgba *colormap,
231  GLint nr, GLint ng, GLint nb, GLint buffersize,
232  FILE *stream, const char *filename);
233 GL2PSDLL_API GLint gl2psEndPage(void);
234 GL2PSDLL_API GLint gl2psSetOptions(GLint options);
235 GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
236 GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
237 GL2PSDLL_API GLint gl2psEndViewport(void);
238 GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
239  GLshort fontsize);
240 GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
241  GLshort fontsize, GLint align, GLfloat angle);
242 GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname,
243  GLshort fontsize, GLint align, GLfloat angle,
244  GL2PSrgba color);
245 GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
246 GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba);
247 GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
248  GLint xorig, GLint yorig,
249  GLenum format, GLenum type, const void *pixels);
250 GL2PSDLL_API GLint gl2psEnable(GLint mode);
251 GL2PSDLL_API GLint gl2psDisable(GLint mode);
252 GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
253 GL2PSDLL_API GLint gl2psLineCap(GLint value);
254 GL2PSDLL_API GLint gl2psLineJoin(GLint value);
255 GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
256 GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
257 
258 /* referenced in the documentation, but not fully documented */
260 GL2PSDLL_API void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
261  GL2PSvertex *verts, GLint offset,
262  GLfloat ofactor, GLfloat ounits,
263  GLushort pattern, GLint factor,
264  GLfloat width, GLint linecap,
265  GLint linejoin, char boundary);
266 
267 /* undocumented */
268 GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
269  const GLfloat position[3],
270  const unsigned char *imagemap);
271 GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
272 GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
274 
275 #if defined(__cplusplus)
276 }
277 #endif
278 
279 #endif /* __GL2PS_H__ */