[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 | * |
---|
[1340] | 55 | * For the latest info about gl2ps and a full list of contributors, |
---|
| 56 | * see http://www.geuz.org/gl2ps/. |
---|
| 57 | * |
---|
[937] | 58 | * Please report all bugs and problems to <gl2ps@geuz.org>. |
---|
[529] | 59 | */ |
---|
| 60 | |
---|
| 61 | #ifndef __GL2PS_H__ |
---|
| 62 | #define __GL2PS_H__ |
---|
| 63 | |
---|
| 64 | #include <stdio.h> |
---|
| 65 | #include <stdlib.h> |
---|
| 66 | |
---|
[937] | 67 | /* Define GL2PSDLL at compile time to build a Windows DLL */ |
---|
[529] | 68 | |
---|
[937] | 69 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) |
---|
| 70 | # if defined(_MSC_VER) |
---|
| 71 | # pragma warning(disable:4115) |
---|
[1340] | 72 | # pragma warning(disable:4996) |
---|
[937] | 73 | # endif |
---|
[529] | 74 | # include <windows.h> |
---|
[937] | 75 | # if defined(GL2PSDLL) |
---|
| 76 | # if defined(GL2PSDLL_EXPORTS) |
---|
[529] | 77 | # define GL2PSDLL_API __declspec(dllexport) |
---|
| 78 | # else |
---|
| 79 | # define GL2PSDLL_API __declspec(dllimport) |
---|
| 80 | # endif |
---|
| 81 | # else |
---|
| 82 | # define GL2PSDLL_API |
---|
| 83 | # endif |
---|
| 84 | #else |
---|
| 85 | # define GL2PSDLL_API |
---|
| 86 | #endif |
---|
| 87 | |
---|
[937] | 88 | #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H) |
---|
[529] | 89 | # include <OpenGL/gl.h> |
---|
| 90 | #else |
---|
| 91 | # include <GL/gl.h> |
---|
| 92 | #endif |
---|
| 93 | |
---|
[937] | 94 | /* Support for compressed PostScript/PDF/SVG and for embedded PNG |
---|
| 95 | images in SVG */ |
---|
[529] | 96 | |
---|
[937] | 97 | #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ) |
---|
| 98 | # define GL2PS_HAVE_ZLIB |
---|
| 99 | # if defined(HAVE_LIBPNG) || defined(HAVE_PNG) |
---|
| 100 | # define GL2PS_HAVE_LIBPNG |
---|
| 101 | # endif |
---|
| 102 | #endif |
---|
[529] | 103 | |
---|
[937] | 104 | /* Version number */ |
---|
[529] | 105 | |
---|
[937] | 106 | #define GL2PS_MAJOR_VERSION 1 |
---|
| 107 | #define GL2PS_MINOR_VERSION 3 |
---|
[1340] | 108 | #define GL2PS_PATCH_VERSION 5 |
---|
[937] | 109 | #define GL2PS_EXTRA_VERSION "" |
---|
[529] | 110 | |
---|
[937] | 111 | #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ |
---|
| 112 | 0.01 * GL2PS_MINOR_VERSION + \ |
---|
| 113 | 0.0001 * GL2PS_PATCH_VERSION) |
---|
[529] | 114 | |
---|
[937] | 115 | #define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine" |
---|
[529] | 116 | |
---|
[937] | 117 | /* Output file formats (the values and the ordering are important!) */ |
---|
[529] | 118 | |
---|
[937] | 119 | #define GL2PS_PS 0 |
---|
| 120 | #define GL2PS_EPS 1 |
---|
| 121 | #define GL2PS_TEX 2 |
---|
| 122 | #define GL2PS_PDF 3 |
---|
| 123 | #define GL2PS_SVG 4 |
---|
| 124 | #define GL2PS_PGF 5 |
---|
[529] | 125 | |
---|
[937] | 126 | /* Sorting algorithms */ |
---|
[529] | 127 | |
---|
[937] | 128 | #define GL2PS_NO_SORT 1 |
---|
| 129 | #define GL2PS_SIMPLE_SORT 2 |
---|
| 130 | #define GL2PS_BSP_SORT 3 |
---|
[529] | 131 | |
---|
| 132 | /* Message levels and error codes */ |
---|
| 133 | |
---|
[937] | 134 | #define GL2PS_SUCCESS 0 |
---|
| 135 | #define GL2PS_INFO 1 |
---|
| 136 | #define GL2PS_WARNING 2 |
---|
| 137 | #define GL2PS_ERROR 3 |
---|
| 138 | #define GL2PS_NO_FEEDBACK 4 |
---|
| 139 | #define GL2PS_OVERFLOW 5 |
---|
| 140 | #define GL2PS_UNINITIALIZED 6 |
---|
[529] | 141 | |
---|
[937] | 142 | /* Options for gl2psBeginPage */ |
---|
[529] | 143 | |
---|
[937] | 144 | #define GL2PS_NONE 0 |
---|
| 145 | #define GL2PS_DRAW_BACKGROUND (1<<0) |
---|
| 146 | #define GL2PS_SIMPLE_LINE_OFFSET (1<<1) |
---|
| 147 | #define GL2PS_SILENT (1<<2) |
---|
| 148 | #define GL2PS_BEST_ROOT (1<<3) |
---|
| 149 | #define GL2PS_OCCLUSION_CULL (1<<4) |
---|
| 150 | #define GL2PS_NO_TEXT (1<<5) |
---|
| 151 | #define GL2PS_LANDSCAPE (1<<6) |
---|
| 152 | #define GL2PS_NO_PS3_SHADING (1<<7) |
---|
| 153 | #define GL2PS_NO_PIXMAP (1<<8) |
---|
| 154 | #define GL2PS_USE_CURRENT_VIEWPORT (1<<9) |
---|
| 155 | #define GL2PS_COMPRESS (1<<10) |
---|
| 156 | #define GL2PS_NO_BLENDING (1<<11) |
---|
| 157 | #define GL2PS_TIGHT_BOUNDING_BOX (1<<12) |
---|
[529] | 158 | |
---|
[937] | 159 | /* Arguments for gl2psEnable/gl2psDisable */ |
---|
[529] | 160 | |
---|
[937] | 161 | #define GL2PS_POLYGON_OFFSET_FILL 1 |
---|
| 162 | #define GL2PS_POLYGON_BOUNDARY 2 |
---|
| 163 | #define GL2PS_LINE_STIPPLE 3 |
---|
| 164 | #define GL2PS_BLEND 4 |
---|
[529] | 165 | |
---|
[937] | 166 | /* Text alignment (o=raster position; default mode is BL): |
---|
| 167 | +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o |
---|
| 168 | | o | o | | o | | | | | | | | | | | | |
---|
| 169 | +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ |
---|
| 170 | C CL CR B BL BR T TL TR */ |
---|
[529] | 171 | |
---|
[937] | 172 | #define GL2PS_TEXT_C 1 |
---|
| 173 | #define GL2PS_TEXT_CL 2 |
---|
| 174 | #define GL2PS_TEXT_CR 3 |
---|
| 175 | #define GL2PS_TEXT_B 4 |
---|
| 176 | #define GL2PS_TEXT_BL 5 |
---|
| 177 | #define GL2PS_TEXT_BR 6 |
---|
| 178 | #define GL2PS_TEXT_T 7 |
---|
| 179 | #define GL2PS_TEXT_TL 8 |
---|
| 180 | #define GL2PS_TEXT_TR 9 |
---|
[529] | 181 | |
---|
| 182 | typedef GLfloat GL2PSrgba[4]; |
---|
| 183 | |
---|
[937] | 184 | #if defined(__cplusplus) |
---|
[529] | 185 | extern "C" { |
---|
| 186 | #endif |
---|
| 187 | |
---|
| 188 | GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, |
---|
[937] | 189 | GLint viewport[4], GLint format, GLint sort, |
---|
| 190 | GLint options, GLint colormode, |
---|
| 191 | GLint colorsize, GL2PSrgba *colormap, |
---|
| 192 | GLint nr, GLint ng, GLint nb, GLint buffersize, |
---|
| 193 | FILE *stream, const char *filename); |
---|
[529] | 194 | GL2PSDLL_API GLint gl2psEndPage(void); |
---|
[937] | 195 | GL2PSDLL_API GLint gl2psSetOptions(GLint options); |
---|
| 196 | GL2PSDLL_API GLint gl2psGetOptions(GLint *options); |
---|
[529] | 197 | GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]); |
---|
| 198 | GL2PSDLL_API GLint gl2psEndViewport(void); |
---|
[937] | 199 | GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, |
---|
| 200 | GLshort fontsize); |
---|
| 201 | GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, |
---|
| 202 | GLshort fontsize, GLint align, GLfloat angle); |
---|
| 203 | GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); |
---|
[529] | 204 | GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, |
---|
[937] | 205 | GLint xorig, GLint yorig, |
---|
| 206 | GLenum format, GLenum type, const void *pixels); |
---|
[529] | 207 | GL2PSDLL_API GLint gl2psEnable(GLint mode); |
---|
| 208 | GL2PSDLL_API GLint gl2psDisable(GLint mode); |
---|
| 209 | GL2PSDLL_API GLint gl2psPointSize(GLfloat value); |
---|
| 210 | GL2PSDLL_API GLint gl2psLineWidth(GLfloat value); |
---|
[937] | 211 | GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor); |
---|
[529] | 212 | |
---|
[937] | 213 | /* undocumented */ |
---|
| 214 | GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, |
---|
| 215 | const GLfloat position[3], |
---|
| 216 | const unsigned char *imagemap); |
---|
| 217 | GL2PSDLL_API const char *gl2psGetFileExtension(GLint format); |
---|
| 218 | GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format); |
---|
| 219 | |
---|
| 220 | #if defined(__cplusplus) |
---|
[529] | 221 | } |
---|
| 222 | #endif |
---|
| 223 | |
---|
| 224 | #endif /* __GL2PS_H__ */ |
---|