From 52880c011e5f794d58542c1231b59a7dffa97169 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 9 May 2004 18:06:01 +0000 Subject: [PATCH] new option: GL2PS_NO_BLENDING --- Makefile | 4 ++++ doc/Makefile | 10 +++++++--- doc/gl2ps.tex | 9 ++++++--- gl2ps.c | 16 ++++++++-------- gl2ps.h | 3 ++- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 25e1b5c..d9b456b 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ clean: rm -f *.tex *.ps *.eps *.eps.gz *.pdf *.o gl2psTest a.out *~ cd doc && ${MAKE} clean +purge: + rm -f `find . -name "*~" -o -name "*~~" -o -name "\#*"\ + -o -name ".\#*" -o -name "gmon.out"` + mac: gcc -Wall -g -o gl2psTest gl2psTest.c gl2ps.c\ -framework OpenGL -framework GLUT -framework Cocoa diff --git a/doc/Makefile b/doc/Makefile index a93c38c..9dbd8e6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,16 +1,20 @@ -default: +default: gl2ps.ps gl2ps.html gl2ps.pdf + +gl2ps.ps: gl2ps.tex + rm -f gl2ps.toc gl2ps.out gl2ps.aux latex gl2ps latex gl2ps latex gl2ps dvips gl2ps -o - make html + +gl2ps.pdf: gl2ps.tex rm -f gl2ps.toc gl2ps.out gl2ps.aux pdflatex gl2ps pdflatex gl2ps pdflatex gl2ps -html: +gl2ps.html: gl2ps.tex gl2ps.ps rm -f gl2ps.html echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" >> gl2ps.html echo "<html>" >> gl2ps.html diff --git a/doc/gl2ps.tex b/doc/gl2ps.tex index 5edbbc0..06f84ff 100644 --- a/doc/gl2ps.tex +++ b/doc/gl2ps.tex @@ -1,4 +1,4 @@ -% $Id: gl2ps.tex,v 1.169 2004-05-09 08:19:33 geuzaine Exp $ +% $Id: gl2ps.tex,v 1.170 2004-05-09 18:06:01 geuzaine Exp $ % % GL2PS, an OpenGL to PostScript Printing Library % Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> @@ -229,6 +229,9 @@ determine the way primitives are handled: the plotting of smooth shaded primitives but can lead to problems when converting PostScript files into PDF files. See also options \dd{nr}, \dd{ng}, \dd{nb} below. +\item[\dd{GL2PS_NO_BLENDING}] Blending (transparency) is disabled + alltogether (regardless of the current \dd{GL_BLEND} or \dd{GL2PS_BLEND} + status). \item[\dd{GL2PS_OCCLUSION_CULL}] All the hidden polygons are removed from the output, thus substantially reducing the size of the output file. \item[\dd{GL2PS_USE_CURRENT_VIEWPORT}] The current OpenGL viewport is used @@ -540,8 +543,8 @@ glGetIntegerv(GL_VIEWPORT, viewport); while( state == GL2PS_OVERFLOW ){ buffsize += 1024*1024; gl2psBeginPage ( "MyTitle", "MySoftware", viewport, - GL2PS_EPS, GL2PS_BSP_SORT, - GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT | + GL2PS_EPS, GL2PS_BSP_SORT, GL2PS_SILENT | + GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT, GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, NULL ); diff --git a/gl2ps.c b/gl2ps.c index a86e124..bd1eb18 100644 --- a/gl2ps.c +++ b/gl2ps.c @@ -1,4 +1,4 @@ -/* $Id: gl2ps.c,v 1.172 2004-05-09 16:35:27 geuzaine Exp $ */ +/* $Id: gl2ps.c,v 1.173 2004-05-09 18:06:01 geuzaine Exp $ */ /* * GL2PS, an OpenGL to PostScript Printing Library * Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> @@ -687,7 +687,7 @@ static void gl2psAdaptVertexForBlending(GL2PSvertex *v) if(!v || !gl2ps) return; - if(GL_FALSE == gl2ps->blending){ + if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ v->rgba[3] = 1.0F; return; } @@ -4399,12 +4399,7 @@ GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, switch(format){ case GL_RGBA: - if(GL_TRUE == glIsEnabled(GL_BLEND)){ - size = height * width * 4; - prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); - memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); - } - else{ + if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ /* special case: blending turned off */ prim->data.image->format = GL_RGB; size = height * width * 3; @@ -4416,6 +4411,11 @@ GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, ++piv; } } + else{ + size = height * width * 4; + prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); + memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); + } break; case GL_RGB: default: diff --git a/gl2ps.h b/gl2ps.h index da014a6..a92bb1f 100644 --- a/gl2ps.h +++ b/gl2ps.h @@ -1,4 +1,4 @@ -/* $Id: gl2ps.h,v 1.86 2004-03-17 17:02:39 geuzaine Exp $ */ +/* $Id: gl2ps.h,v 1.87 2004-05-09 18:06:01 geuzaine Exp $ */ /* * GL2PS, an OpenGL to PostScript Printing Library * Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> @@ -123,6 +123,7 @@ #define GL2PS_NO_PIXMAP (1<<8) #define GL2PS_USE_CURRENT_VIEWPORT (1<<9) #define GL2PS_COMPRESS (1<<10) +#define GL2PS_NO_BLENDING (1<<11) /* Arguments for gl2psEnable/gl2psDisable */ -- GitLab