Geant4-11
gl2ps.h
Go to the documentation of this file.
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-2020 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# if !defined(NOMINMAX)
77# define NOMINMAX
78# endif
79# include <windows.h>
80# undef NOMINMAX
81# if defined(GL2PSDLL)
82# if defined(GL2PSDLL_EXPORTS)
83# define GL2PSDLL_API __declspec(dllexport)
84# else
85# define GL2PSDLL_API __declspec(dllimport)
86# endif
87# else
88# define GL2PSDLL_API
89# endif
90#else
91# define GL2PSDLL_API
92#endif
93
94#if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
95# include <OpenGL/gl.h>
96#else
97# include <GL/gl.h>
98#endif
99
100/* Support for compressed PostScript/PDF/SVG and for embedded PNG
101 images in SVG */
102
103#if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
104# define GL2PS_HAVE_ZLIB
105# if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
106# define GL2PS_HAVE_LIBPNG
107# endif
108#endif
109
110#if defined(HAVE_NO_VSNPRINTF)
111# define GL2PS_HAVE_NO_VSNPRINTF
112#endif
113
114/* Version number */
115
116#define GL2PS_MAJOR_VERSION 1
117#define GL2PS_MINOR_VERSION 4
118#define GL2PS_PATCH_VERSION 2
119#define GL2PS_EXTRA_VERSION ""
120
121#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
122 0.01 * GL2PS_MINOR_VERSION + \
123 0.0001 * GL2PS_PATCH_VERSION)
124
125#define GL2PS_COPYRIGHT "(C) 1999-2020 C. Geuzaine"
126
127/* Output file formats (the values and the ordering are important!) */
128
129#define GL2PS_PS 0
130#define GL2PS_EPS 1
131#define GL2PS_TEX 2
132#define GL2PS_PDF 3
133#define GL2PS_SVG 4
134#define GL2PS_PGF 5
135
136/* Sorting algorithms */
137
138#define GL2PS_NO_SORT 1
139#define GL2PS_SIMPLE_SORT 2
140#define GL2PS_BSP_SORT 3
141
142/* Message levels and error codes */
143
144#define GL2PS_SUCCESS 0
145#define GL2PS_INFO 1
146#define GL2PS_WARNING 2
147#define GL2PS_ERROR 3
148#define GL2PS_NO_FEEDBACK 4
149#define GL2PS_OVERFLOW 5
150#define GL2PS_UNINITIALIZED 6
151
152/* Options for gl2psBeginPage */
153
154#define GL2PS_NONE 0
155#define GL2PS_DRAW_BACKGROUND (1<<0)
156#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
157#define GL2PS_SILENT (1<<2)
158#define GL2PS_BEST_ROOT (1<<3)
159#define GL2PS_OCCLUSION_CULL (1<<4)
160#define GL2PS_NO_TEXT (1<<5)
161#define GL2PS_LANDSCAPE (1<<6)
162#define GL2PS_NO_PS3_SHADING (1<<7)
163#define GL2PS_NO_PIXMAP (1<<8)
164#define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
165#define GL2PS_COMPRESS (1<<10)
166#define GL2PS_NO_BLENDING (1<<11)
167#define GL2PS_TIGHT_BOUNDING_BOX (1<<12)
168#define GL2PS_NO_OPENGL_CONTEXT (1<<13)
169#define GL2PS_NO_TEX_FONTSIZE (1<<14)
170
171/* Arguments for gl2psEnable/gl2psDisable */
172
173#define GL2PS_POLYGON_OFFSET_FILL 1
174#define GL2PS_POLYGON_BOUNDARY 2
175#define GL2PS_LINE_STIPPLE 3
176#define GL2PS_BLEND 4
177
178/* Arguments for gl2psLineCap/Join */
179
180#define GL2PS_LINE_CAP_BUTT 0
181#define GL2PS_LINE_CAP_ROUND 1
182#define GL2PS_LINE_CAP_SQUARE 2
183
184#define GL2PS_LINE_JOIN_MITER 0
185#define GL2PS_LINE_JOIN_ROUND 1
186#define GL2PS_LINE_JOIN_BEVEL 2
187
188/* Text alignment (o=raster position; default mode is BL):
189 +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
190 | o | o | | o | | | | | | | | | | | |
191 +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
192 C CL CR B BL BR T TL TR */
193
194#define GL2PS_TEXT_C 1
195#define GL2PS_TEXT_CL 2
196#define GL2PS_TEXT_CR 3
197#define GL2PS_TEXT_B 4
198#define GL2PS_TEXT_BL 5
199#define GL2PS_TEXT_BR 6
200#define GL2PS_TEXT_T 7
201#define GL2PS_TEXT_TL 8
202#define GL2PS_TEXT_TR 9
203
204typedef GLfloat GL2PSrgba[4];
205typedef GLfloat GL2PSxyz[3];
206
207typedef struct {
211
212/* Primitive types */
213#define GL2PS_NO_TYPE -1
214#define GL2PS_TEXT 1
215#define GL2PS_POINT 2
216#define GL2PS_LINE 3
217#define GL2PS_QUADRANGLE 4
218#define GL2PS_TRIANGLE 5
219#define GL2PS_PIXMAP 6
220#define GL2PS_IMAGEMAP 7
221#define GL2PS_IMAGEMAP_WRITTEN 8
222#define GL2PS_IMAGEMAP_VISIBLE 9
223#define GL2PS_SPECIAL 10
224
225#if defined(__cplusplus)
226extern "C" {
227#endif
228
229GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
230 GLint viewport[4], GLint format, GLint sort,
231 GLint options, GLint colormode,
232 GLint colorsize, GL2PSrgba *colormap,
233 GLint nr, GLint ng, GLint nb, GLint buffersize,
234 FILE *stream, const char *filename);
235GL2PSDLL_API GLint gl2psEndPage(void);
236GL2PSDLL_API GLint gl2psSetOptions(GLint options);
237GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
238GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
240GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
241 GLshort fontsize);
242GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
243 GLshort fontsize, GLint align, GLfloat angle);
244GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname,
245 GLshort fontsize, GLint align, GLfloat angle,
246 GL2PSrgba color);
247GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname,
248 GLshort fontsize, GLint align, GLfloat angle,
249 GL2PSrgba color, GLfloat blx, GLfloat bly);
250GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
251GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba);
252GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
253 GLint xorig, GLint yorig,
254 GLenum format, GLenum type, const void *pixels);
255GL2PSDLL_API GLint gl2psEnable(GLint mode);
256GL2PSDLL_API GLint gl2psDisable(GLint mode);
257GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
258GL2PSDLL_API GLint gl2psLineCap(GLint value);
259GL2PSDLL_API GLint gl2psLineJoin(GLint value);
260GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
261GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
262GL2PSDLL_API GLint gl2psSorting(GLint mode);
263
264/* referenced in the documentation, but not fully documented */
266GL2PSDLL_API void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
267 GL2PSvertex *verts, GLint offset,
268 GLfloat ofactor, GLfloat ounits,
269 GLushort pattern, GLint factor,
270 GLfloat width, GLint linecap,
271 GLint linejoin, char boundary);
272
273/* undocumented */
274GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
275 const GLfloat position[3],
276 const unsigned char *imagemap);
277GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
278GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
280GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling);
281
282#if defined(__cplusplus)
283}
284#endif
285
286#endif
287
static const G4double angle[DIMMOTT]
GL2PSDLL_API GLint gl2psLineJoin(GLint value)
Definition: gl2ps.cc:6532
GL2PSDLL_API GLint gl2psEndViewport(void)
Definition: gl2ps.cc:6232
GL2PSDLL_API const char * gl2psGetFormatDescription(GLint format)
Definition: gl2ps.cc:6600
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels)
Definition: gl2ps.cc:6312
GL2PSDLL_API GLint gl2psLineCap(GLint value)
Definition: gl2ps.cc:6522
GL2PSDLL_API const char * gl2psGetFileExtension(GLint format)
Definition: gl2ps.cc:6592
GL2PSDLL_API GLint gl2psPointSize(GLfloat value)
Definition: gl2ps.cc:6512
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str)
Definition: gl2ps.cc:6302
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.cc:6002
GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle, GL2PSrgba color)
Definition: gl2ps.cc:6269
GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor)
Definition: gl2ps.cc:6552
GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, const GLfloat position[3], const unsigned char *imagemap)
Definition: gl2ps.cc:6426
GL2PSDLL_API GLint gl2psSetOptions(GLint options)
Definition: gl2ps.cc:6567
GL2PSDLL_API GLint gl2psDisable(GLint mode)
Definition: gl2ps.cc:6487
#define GL2PSDLL_API
Definition: gl2ps.h:91
GLfloat GL2PSrgba[4]
Definition: gl2ps.h:204
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4])
Definition: gl2ps.cc:6223
GL2PSDLL_API GLint gl2psGetFileFormat()
Definition: gl2ps.cc:6608
GL2PSDLL_API void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, GL2PSvertex *verts, GLint offset, GLfloat ofactor, GLfloat ounits, GLushort pattern, GLint factor, GLfloat width, GLint linecap, GLint linejoin, char boundary)
Definition: gl2ps.cc:2263
GL2PSDLL_API GLint gl2psEndPage(void)
Definition: gl2ps.cc:6196
GL2PSDLL_API GLint gl2psSorting(GLint mode)
Definition: gl2ps.cc:6246
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle)
Definition: gl2ps.cc:6290
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize)
Definition: gl2ps.cc:6296
GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba)
Definition: gl2ps.cc:6307
GL2PSDLL_API GLint gl2psEnable(GLint mode)
Definition: gl2ps.cc:6451
GLfloat GL2PSxyz[3]
Definition: gl2ps.h:205
GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling)
Definition: gl2ps.cc:6636
GL2PSDLL_API GLint gl2psForceRasterPos(GL2PSvertex *vert)
Definition: gl2ps.cc:6617
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value)
Definition: gl2ps.cc:6542
GL2PSDLL_API GLint gl2psGetOptions(GLint *options)
Definition: gl2ps.cc:6580
GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle, GL2PSrgba color, GLfloat blx, GLfloat bly)
Definition: gl2ps.cc:6282
GL2PSxyz xyz
Definition: gl2ps.h:208
GL2PSrgba rgba
Definition: gl2ps.h:209