[529] | 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 | * GL2PS, an OpenGL to PostScript Printing Library |
---|
[937] | 28 | * Copyright (C) 1999-2009 C. Geuzaine |
---|
[529] | 29 | * |
---|
[937] | 30 | * This program is free software; you can redistribute it and/or |
---|
| 31 | * modify it under the terms of either: |
---|
[529] | 32 | * |
---|
[937] | 33 | * a) the GNU Library General Public License as published by the Free |
---|
| 34 | * Software Foundation, either version 2 of the License, or (at your |
---|
| 35 | * option) any later version; or |
---|
[529] | 36 | * |
---|
[937] | 37 | * b) the GL2PS License as published by Christophe Geuzaine, either |
---|
[529] | 38 | * version 2 of the License, or (at your option) any later version. |
---|
| 39 | * |
---|
[937] | 40 | * This program is distributed in the hope that it will be useful, but |
---|
| 41 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 42 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either |
---|
| 43 | * the GNU Library General Public License or the GL2PS License for |
---|
| 44 | * more details. |
---|
[529] | 45 | * |
---|
| 46 | * You should have received a copy of the GNU Library General Public |
---|
[937] | 47 | * License along with this library in the file named "COPYING.LGPL"; |
---|
| 48 | * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, |
---|
| 49 | * Cambridge, MA 02139, USA. |
---|
[529] | 50 | * |
---|
[937] | 51 | * You should have received a copy of the GL2PS License with this |
---|
| 52 | * library in the file named "COPYING.GL2PS"; if not, I will be glad |
---|
| 53 | * to provide one. |
---|
| 54 | * |
---|
| 55 | * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. |
---|
| 56 | * Please report all bugs and problems to <gl2ps@geuz.org>. |
---|
[529] | 57 | */ |
---|
| 58 | |
---|
| 59 | #ifndef __GL2PS_H__ |
---|
| 60 | #define __GL2PS_H__ |
---|
| 61 | |
---|
| 62 | #include <stdio.h> |
---|
| 63 | #include <stdlib.h> |
---|
| 64 | |
---|
[937] | 65 | /* Define GL2PSDLL at compile time to build a Windows DLL */ |
---|
[529] | 66 | |
---|
[937] | 67 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) |
---|
| 68 | # if defined(_MSC_VER) |
---|
| 69 | # pragma warning(disable:4115) |
---|
| 70 | # endif |
---|
[529] | 71 | # include <windows.h> |
---|
[937] | 72 | # if defined(GL2PSDLL) |
---|
| 73 | # if defined(GL2PSDLL_EXPORTS) |
---|
[529] | 74 | # define GL2PSDLL_API __declspec(dllexport) |
---|
| 75 | # else |
---|
| 76 | # define GL2PSDLL_API __declspec(dllimport) |
---|
| 77 | # endif |
---|
| 78 | # else |
---|
| 79 | # define GL2PSDLL_API |
---|
| 80 | # endif |
---|
| 81 | #else |
---|
| 82 | # define GL2PSDLL_API |
---|
| 83 | #endif |
---|
| 84 | |
---|
[937] | 85 | #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H) |
---|
[529] | 86 | # include <OpenGL/gl.h> |
---|
| 87 | #else |
---|
| 88 | # include <GL/gl.h> |
---|
| 89 | #endif |
---|
| 90 | |
---|
[937] | 91 | /* Support for compressed PostScript/PDF/SVG and for embedded PNG |
---|
| 92 | images in SVG */ |
---|
[529] | 93 | |
---|
[937] | 94 | #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ) |
---|
| 95 | # define GL2PS_HAVE_ZLIB |
---|
| 96 | # if defined(HAVE_LIBPNG) || defined(HAVE_PNG) |
---|
| 97 | # define GL2PS_HAVE_LIBPNG |
---|
| 98 | # endif |
---|
| 99 | #endif |
---|
[529] | 100 | |
---|
[937] | 101 | /* Version number */ |
---|
[529] | 102 | |
---|
[937] | 103 | #define GL2PS_MAJOR_VERSION 1 |
---|
| 104 | #define GL2PS_MINOR_VERSION 3 |
---|
| 105 | #define GL2PS_PATCH_VERSION 3 |
---|
| 106 | #define GL2PS_EXTRA_VERSION "" |
---|
[529] | 107 | |
---|
[937] | 108 | #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ |
---|
| 109 | 0.01 * GL2PS_MINOR_VERSION + \ |
---|
| 110 | 0.0001 * GL2PS_PATCH_VERSION) |
---|
[529] | 111 | |
---|
[937] | 112 | #define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine" |
---|
[529] | 113 | |
---|
[937] | 114 | /* Output file formats (the values and the ordering are important!) */ |
---|
[529] | 115 | |
---|
[937] | 116 | #define GL2PS_PS 0 |
---|
| 117 | #define GL2PS_EPS 1 |
---|
| 118 | #define GL2PS_TEX 2 |
---|
| 119 | #define GL2PS_PDF 3 |
---|
| 120 | #define GL2PS_SVG 4 |
---|
| 121 | #define GL2PS_PGF 5 |
---|
[529] | 122 | |
---|
[937] | 123 | /* Sorting algorithms */ |
---|
[529] | 124 | |
---|
[937] | 125 | #define GL2PS_NO_SORT 1 |
---|
| 126 | #define GL2PS_SIMPLE_SORT 2 |
---|
| 127 | #define GL2PS_BSP_SORT 3 |
---|
[529] | 128 | |
---|
| 129 | /* Message levels and error codes */ |
---|
| 130 | |
---|
[937] | 131 | #define GL2PS_SUCCESS 0 |
---|
| 132 | #define GL2PS_INFO 1 |
---|
| 133 | #define GL2PS_WARNING 2 |
---|
| 134 | #define GL2PS_ERROR 3 |
---|
| 135 | #define GL2PS_NO_FEEDBACK 4 |
---|
| 136 | #define GL2PS_OVERFLOW 5 |
---|
| 137 | #define GL2PS_UNINITIALIZED 6 |
---|
[529] | 138 | |
---|
[937] | 139 | /* Options for gl2psBeginPage */ |
---|
[529] | 140 | |
---|
[937] | 141 | #define GL2PS_NONE 0 |
---|
| 142 | #define GL2PS_DRAW_BACKGROUND (1<<0) |
---|
| 143 | #define GL2PS_SIMPLE_LINE_OFFSET (1<<1) |
---|
| 144 | #define GL2PS_SILENT (1<<2) |
---|
| 145 | #define GL2PS_BEST_ROOT (1<<3) |
---|
| 146 | #define GL2PS_OCCLUSION_CULL (1<<4) |
---|
| 147 | #define GL2PS_NO_TEXT (1<<5) |
---|
| 148 | #define GL2PS_LANDSCAPE (1<<6) |
---|
| 149 | #define GL2PS_NO_PS3_SHADING (1<<7) |
---|
| 150 | #define GL2PS_NO_PIXMAP (1<<8) |
---|
| 151 | #define GL2PS_USE_CURRENT_VIEWPORT (1<<9) |
---|
| 152 | #define GL2PS_COMPRESS (1<<10) |
---|
| 153 | #define GL2PS_NO_BLENDING (1<<11) |
---|
| 154 | #define GL2PS_TIGHT_BOUNDING_BOX (1<<12) |
---|
[529] | 155 | |
---|
[937] | 156 | /* Arguments for gl2psEnable/gl2psDisable */ |
---|
[529] | 157 | |
---|
[937] | 158 | #define GL2PS_POLYGON_OFFSET_FILL 1 |
---|
| 159 | #define GL2PS_POLYGON_BOUNDARY 2 |
---|
| 160 | #define GL2PS_LINE_STIPPLE 3 |
---|
| 161 | #define GL2PS_BLEND 4 |
---|
[529] | 162 | |
---|
[937] | 163 | /* Text alignment (o=raster position; default mode is BL): |
---|
| 164 | +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o |
---|
| 165 | | o | o | | o | | | | | | | | | | | | |
---|
| 166 | +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ |
---|
| 167 | C CL CR B BL BR T TL TR */ |
---|
[529] | 168 | |
---|
[937] | 169 | #define GL2PS_TEXT_C 1 |
---|
| 170 | #define GL2PS_TEXT_CL 2 |
---|
| 171 | #define GL2PS_TEXT_CR 3 |
---|
| 172 | #define GL2PS_TEXT_B 4 |
---|
| 173 | #define GL2PS_TEXT_BL 5 |
---|
| 174 | #define GL2PS_TEXT_BR 6 |
---|
| 175 | #define GL2PS_TEXT_T 7 |
---|
| 176 | #define GL2PS_TEXT_TL 8 |
---|
| 177 | #define GL2PS_TEXT_TR 9 |
---|
[529] | 178 | |
---|
| 179 | typedef GLfloat GL2PSrgba[4]; |
---|
| 180 | |
---|
[937] | 181 | #if defined(__cplusplus) |
---|
[529] | 182 | extern "C" { |
---|
| 183 | #endif |
---|
| 184 | |
---|
| 185 | GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, |
---|
[937] | 186 | GLint viewport[4], GLint format, GLint sort, |
---|
| 187 | GLint options, GLint colormode, |
---|
| 188 | GLint colorsize, GL2PSrgba *colormap, |
---|
| 189 | GLint nr, GLint ng, GLint nb, GLint buffersize, |
---|
| 190 | FILE *stream, const char *filename); |
---|
[529] | 191 | GL2PSDLL_API GLint gl2psEndPage(void); |
---|
[937] | 192 | GL2PSDLL_API GLint gl2psSetOptions(GLint options); |
---|
| 193 | GL2PSDLL_API GLint gl2psGetOptions(GLint *options); |
---|
[529] | 194 | GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]); |
---|
| 195 | GL2PSDLL_API GLint gl2psEndViewport(void); |
---|
[937] | 196 | GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, |
---|
| 197 | GLshort fontsize); |
---|
| 198 | GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, |
---|
| 199 | GLshort fontsize, GLint align, GLfloat angle); |
---|
| 200 | GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); |
---|
[529] | 201 | GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, |
---|
[937] | 202 | GLint xorig, GLint yorig, |
---|
| 203 | GLenum format, GLenum type, const void *pixels); |
---|
[529] | 204 | GL2PSDLL_API GLint gl2psEnable(GLint mode); |
---|
| 205 | GL2PSDLL_API GLint gl2psDisable(GLint mode); |
---|
| 206 | GL2PSDLL_API GLint gl2psPointSize(GLfloat value); |
---|
| 207 | GL2PSDLL_API GLint gl2psLineWidth(GLfloat value); |
---|
[937] | 208 | GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor); |
---|
[529] | 209 | |
---|
[937] | 210 | /* undocumented */ |
---|
| 211 | GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, |
---|
| 212 | const GLfloat position[3], |
---|
| 213 | const unsigned char *imagemap); |
---|
| 214 | GL2PSDLL_API const char *gl2psGetFileExtension(GLint format); |
---|
| 215 | GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format); |
---|
| 216 | |
---|
| 217 | #if defined(__cplusplus) |
---|
[529] | 218 | } |
---|
| 219 | #endif |
---|
| 220 | |
---|
| 221 | #endif /* __GL2PS_H__ */ |
---|