72#if defined(GL2PS_HAVE_ZLIB)
76#if defined(GL2PS_HAVE_LIBPNG)
89#define GL2PS_EPSILON 5.0e-3F
90#define GL2PS_ZSCALE 1000.0F
91#define GL2PS_ZOFFSET 5.0e-2F
92#define GL2PS_ZOFFSET_LARGE 20.0F
93#define GL2PS_ZERO(arg) (std::fabs(arg) < 1.e-20)
97#define GL2PS_COINCIDENT 1
98#define GL2PS_IN_FRONT_OF 2
99#define GL2PS_IN_BACK_OF 3
100#define GL2PS_SPANNING 4
104#define GL2PS_POINT_COINCIDENT 0
105#define GL2PS_POINT_INFRONT 1
106#define GL2PS_POINT_BACK 2
110#define GL2PS_BEGIN_OFFSET_TOKEN 1
111#define GL2PS_END_OFFSET_TOKEN 2
112#define GL2PS_BEGIN_BOUNDARY_TOKEN 3
113#define GL2PS_END_BOUNDARY_TOKEN 4
114#define GL2PS_BEGIN_STIPPLE_TOKEN 5
115#define GL2PS_END_STIPPLE_TOKEN 6
116#define GL2PS_POINT_SIZE_TOKEN 7
117#define GL2PS_LINE_CAP_TOKEN 8
118#define GL2PS_LINE_JOIN_TOKEN 9
119#define GL2PS_LINE_WIDTH_TOKEN 10
120#define GL2PS_BEGIN_BLEND_TOKEN 11
121#define GL2PS_END_BLEND_TOKEN 12
122#define GL2PS_SRC_BLEND_TOKEN 13
123#define GL2PS_DST_BLEND_TOKEN 14
124#define GL2PS_IMAGEMAP_TOKEN 15
125#define GL2PS_DRAW_PIXELS_TOKEN 16
126#define GL2PS_TEXT_TOKEN 17
204#if defined(GL2PS_HAVE_ZLIB)
205 Bytef *dest, *src, *start;
206 uLongf destLen, srcLen;
214 int gsno,
fontno, imno, shno, maskshno, trgroupno;
215 int gsobjno,
fontobjno, imobjno, shobjno, maskshobjno, trgroupobjno;
220 GLint format, sort, options, colorsize, colormode,
buffersize;
225 GLint viewport[4], blendfunc[2], lastfactor;
265 void (*printHeader)(void);
266 void (*printFooter)(void);
267 void (*beginViewport)(GLint viewport[4]);
268 GLint (*endViewport)(void);
269 void (*printPrimitive)(
void *data);
270 void (*printFinalPrimitive)(void);
290static void gl2psMsg(GLint level,
const char *fmt, ...)
296 case GL2PS_INFO : fprintf(stderr,
"GL2PS info: ");
break;
297 case GL2PS_WARNING : fprintf(stderr,
"GL2PS warning: ");
break;
298 case GL2PS_ERROR : fprintf(stderr,
"GL2PS error: ");
break;
301 vfprintf(stderr, fmt,
args);
303 fprintf(stderr,
"\n");
312 if(!size)
return NULL;
324 if(!size)
return NULL;
325 ptr = realloc(orig, size);
343 int size =
sizeof(
unsigned long);
344 for(i = 1; i <= bytes; ++i){
345 fputc(0xff & (data >> (size - i) * 8),
gl2ps->
stream);
352#if defined(GL2PS_HAVE_ZLIB)
398 if(srcsize < gl2ps->
compress->srcLen)
415 int size =
sizeof(
unsigned long);
416 for(i = 1; i <= bytes; ++i){
417 *
gl2ps->
compress->src = (Bytef)(0xff & (data >> (size-i) * 8));
438#if defined(GL2PS_HAVE_ZLIB)
439 static char buf[1024];
441 GLboolean freebuf = GL_FALSE;
442 unsigned int oldsize = 0;
443#if !defined(GL2PS_HAVE_NO_VSNPRINTF)
446 int bufsize =
sizeof(buf);
450#if defined(GL2PS_HAVE_NO_VSNPRINTF)
451 ret = vsprintf(buf, fmt,
args);
453 ret = vsnprintf(bufptr, bufsize, fmt,
args);
456#if !defined(GL2PS_HAVE_NO_VSNPRINTF)
457 while(ret >= (bufsize - 1) || ret < 0){
460 if(freebuf == GL_TRUE)
gl2psFree(bufptr);
464 ret = vsnprintf(bufptr, bufsize, fmt,
args);
471 if(freebuf == GL_TRUE)
gl2psFree(bufptr);
479#if defined(GL2PS_HAVE_ZLIB)
487#if defined(GL2PS_HAVE_ZLIB)
488 char tmp[10] = {
'\x1f',
'\x8b',
505#if defined(GL2PS_HAVE_ZLIB)
525 for(
n = 0;
n < 4; ++
n){
526 tmp[
n] = (char)(crc & 0xff);
530 for(
n = 4;
n < 8; ++
n){
531 tmp[
n] = (char)(len & 0xff);
570 if(incr <= 0) incr = 1;
602 memcpy(&list->
array[(list->
n - 1) * list->
size], data, list->
size);
618 if((idx < 0) || (idx >= list->
n)){
626 int (*fcmp)(
const void *a,
const void *b))
630 qsort(list->
array, list->
n, list->
size, fcmp);
660#if defined(GL2PS_HAVE_LIBPNG)
664 if((index < 0) || (index >= list->
n))
671 static const char cb64[] =
672 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
674 out[0] = cb64[ in[0] >> 2 ];
675 out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ];
676 out[2] = (len > 1) ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] :
'=';
677 out[3] = (len > 2) ? cb64[ in[2] & 0x3f ] :
'=';
682 unsigned char *
buffer, in[3], out[4];
683 int i,
n, index, len;
693 for(i = 0; i < 3; i++) {
705 for(i = 0; i < 4; i++)
729 for(i = 1; i < prim->
numverts; i++){
742 if(
n < 2)
return GL_TRUE;
744 for(i = 1; i <
n; i++){
745 if(std::fabs(rgba[0][0] - rgba[i][0]) > threshold[0] ||
746 std::fabs(rgba[0][1] - rgba[i][1]) > threshold[1] ||
747 std::fabs(rgba[0][2] - rgba[i][2]) > threshold[2])
757 for(i = 0; i < 3; ++i){
763 GLfloat *red, GLfloat *green, GLfloat *blue)
766 GLsizei width = im->
width;
767 GLsizei height = im->
height;
768 GLfloat *pixels = im->
pixels;
774 pimag = pixels + 4 * (width * (height - 1 - y) + x);
778 pimag = pixels + 3 * (width * (height - 1 - y) + x);
781 *red = *pimag; pimag++;
782 *green = *pimag; pimag++;
783 *blue = *pimag; pimag++;
785 return (im->
format == GL_RGBA) ? *pimag : 1.0F;
804 size = image->
height * image->
width * 4 *
sizeof(GLfloat);
808 size = image->
height * image->
width * 3 *
sizeof(GLfloat);
826#if defined(GL2PS_HAVE_LIBPNG)
828#if !defined(png_jmpbuf)
829# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
832static void gl2psUserWritePNG(png_structp png_ptr, png_bytep data, png_size_t length)
836 for(i = 0; i < length; i++)
849 unsigned char *row_data;
853 if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)))
856 if(!(info_ptr = png_create_info_struct(png_ptr))){
857 png_destroy_write_struct(&png_ptr, NULL);
861 if(setjmp(png_jmpbuf(png_ptr))) {
862 png_destroy_write_struct(&png_ptr, &info_ptr);
868 png_set_IHDR(png_ptr, info_ptr, pixmap->
width, pixmap->
height, 8,
869 PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
870 PNG_FILTER_TYPE_BASE);
871 png_write_info(png_ptr, info_ptr);
873 row_data = (
unsigned char*)
gl2psMalloc(3 * pixmap->
width *
sizeof(
unsigned char));
874 for(row = 0; row < pixmap->
height; row++){
875 for(col = 0; col < pixmap->
width; col++){
877 row_data[3*col] = (
unsigned char)(255. * dr);
878 row_data[3*col+1] = (
unsigned char)(255. * dg);
879 row_data[3*col+2] = (
unsigned char)(255. * db);
881 png_write_row(png_ptr, (png_bytep)row_data);
885 png_write_end(png_ptr, info_ptr);
886 png_destroy_write_struct(&png_ptr, &info_ptr);
893static GLint
gl2psAddText(GLint type,
const char *str,
const char *fontname,
894 GLshort fontsize, GLint alignment, GLfloat
angle,
896 GLfloat blx, GLfloat bly)
913 glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid);
915 glGetFloatv(GL_CURRENT_RASTER_POSITION,
pos);
919 prim->
type = (GLshort)type;
942 memcpy(prim->
verts[0].
rgba, color, 4 *
sizeof(
float));
952 glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->
verts[0].
rgba);
982 strcpy(text->
str, t->
str);
1008 if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) ||
1009 (sfactor == GL_ONE && dfactor == GL_ZERO) )
1072 GLboolean assignprops)
1077 if(GL_TRUE == assignprops)
1084 GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} };
1085 for(i = 0; i < 3; i++)
1156 return (plane[0] * point[0] +
1157 plane[1] * point[1] +
1158 plane[2] * point[2] +
1164 return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);
1169 c[0] = a[1]*b[2] - a[2]*b[1];
1170 c[1] = a[2]*b[0] - a[0]*b[2];
1171 c[2] = a[0]*b[1] - a[1]*b[0];
1176 return (GLfloat)sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
1200 GL2PSxyz v = {0.0F, 0.0F, 0.0F}, w = {0.0F, 0.0F, 0.0F};
1213 plane[0] = plane[1] = 0.0F;
1222 - plane[2] * prim->
verts[0].
xyz[2];
1230 plane[0] = plane[1] = 0.0F;
1242 - plane[2] * prim->
verts[0].
xyz[2];
1250 plane[0] = plane[1] = 0.0F;
1256 plane[0] = plane[1] = plane[3] = 0.0F;
1268 v[0] = b->
xyz[0] - a->
xyz[0];
1269 v[1] = b->
xyz[1] - a->
xyz[1];
1270 v[2] = b->
xyz[2] - a->
xyz[2];
1277 c->
xyz[0] = a->
xyz[0] + v[0] * sect;
1278 c->
xyz[1] = a->
xyz[1] + v[1] * sect;
1279 c->
xyz[2] = a->
xyz[2] + v[2] * sect;
1281 c->
rgba[0] = (1 - sect) * a->
rgba[0] + sect * b->
rgba[0];
1282 c->
rgba[1] = (1 - sect) * a->
rgba[1] + sect * b->
rgba[1];
1283 c->
rgba[2] = (1 - sect) * a->
rgba[2] + sect * b->
rgba[2];
1284 c->
rgba[3] = (1 - sect) * a->
rgba[3] + sect * b->
rgba[3];
1289 GLshort *index0, GLshort *index1)
1324 for(i = 0; i < numverts; i++){
1330 plane, &child->
verts[i]);
1336 GLshort i, GLshort j)
1340 for(k = 0; k < *nb; k++){
1341 if((index0[k] == i && index1[k] == j) ||
1342 (index1[k] == i && index0[k] == j))
return;
1351 return (i < num - 1) ? i + 1 : 0;
1360 for(i = 0; i < prim->
numverts; i++){
1368 for(i = 0; i < prim->
numverts; i++){
1388 GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5];
1394 for(i = 0; i < prim->
numverts; i++){
1405 for(i = 0; i < prim->
numverts; i++){
1451 (*t1)->numverts = (*t2)->numverts = 3;
1452 (*t1)->culled = (*t2)->culled = quad->
culled;
1453 (*t1)->offset = (*t2)->offset = quad->
offset;
1454 (*t1)->ofactor = (*t2)->ofactor = quad->
ofactor;
1455 (*t1)->ounits = (*t2)->ounits = quad->
ounits;
1456 (*t1)->pattern = (*t2)->pattern = quad->
pattern;
1457 (*t1)->factor = (*t2)->factor = quad->
factor;
1458 (*t1)->width = (*t2)->width = quad->
width;
1459 (*t1)->linecap = (*t2)->linecap = quad->
linecap;
1460 (*t1)->linejoin = (*t2)->linejoin = quad->
linejoin;
1463 (*t1)->verts[0] = quad->
verts[0];
1464 (*t1)->verts[1] = quad->
verts[1];
1465 (*t1)->verts[2] = quad->
verts[2];
1466 (*t1)->boundary = ((quad->
boundary & 1) ? 1 : 0) | ((quad->
boundary & 2) ? 2 : 0);
1467 (*t2)->verts[0] = quad->
verts[0];
1468 (*t2)->verts[1] = quad->
verts[2];
1469 (*t2)->verts[2] = quad->
verts[3];
1470 (*t2)->boundary = ((quad->
boundary & 4) ? 2 : 0) | ((quad->
boundary & 8) ? 4 : 0);
1476 GLfloat dq = 0.0F, dw = 0.0F, diff;
1487 for(i = 0; i < w->numverts; i++){
1511 return (q->
type < w->
type ? 1 : -1);
1516 GLint i, j, count, best = 1000000, idx = 0;
1533 for(i = 0; i < maxp; i++){
1542 if(count > best)
break;
1548 if(!count)
return idx;
1562 while(list != NULL){
1606 if((*tree)->primitives){
1618 if(f1 > f2)
return GL_TRUE;
1619 else return GL_FALSE;
1624 if(f1 < f2)
return GL_TRUE;
1625 else return GL_FALSE;
1630 GL2PSprimitive *prim = NULL, *frontprim = NULL, *backprim = NULL;
1692 GLboolean (*compare)(GLfloat f1, GLfloat f2),
1693 void (*
action)(
void *data),
int inverse)
1701 if(GL_TRUE == compare(result,
epsilon)){
1711 else if(GL_TRUE == compare(-
epsilon, result)){
1730 GLfloat minZ,
maxZ, rangeZ, scaleZ;
1731 GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ;
1740 for(i = 1; i < prim->
numverts; i++){
1746 for(j = 0; j < prim->
numverts; j++){
1751 rangeZ = (
maxZ - minZ);
1757 if(scaleZ > 100000.F) scaleZ = 100000.F;
1762 for(j = 0; j < prim->
numverts; j++){
1795 maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY);
1800 dZ = factor * maxdZ + units;
1818 plane[0] = b[1] - a[1];
1819 plane[1] = a[0] - b[0];
1820 n = (GLfloat)sqrt(plane[0]*plane[0] + plane[1]*plane[1]);
1825 plane[3] = -plane[0]*a[0]-plane[1]*a[1];
1864 if((*tree == NULL) && (prim->
numverts > 2)){
1870 for(i = 0; i < prim->
numverts-1; i++){
1888 for(i = 2+offset; i < prim->
numverts; i++){
1895 for(i = 1+offset; i < prim->
numverts-1; i++){
1896 if(cur->front == NULL){
1901 cur->front->plane)){
1907 if(cur->front == NULL){
1912 cur->front->plane)){
1913 cur->front->front = NULL;
1914 cur->front->back = NULL;
1922 for(i = 0; i < 4; i++){
1926 for(i = 1+offset; i < prim->
numverts-1; i++){
1927 if(cur->front == NULL){
1932 cur->front->plane)){
1938 if(cur->front == NULL){
1943 cur->front->plane)){
1944 cur->front->front = NULL;
1945 cur->front->back = NULL;
1966 for(i = 1; i < prim->
numverts; i++){
2007 for(i = 0; i < numverts; i++){
2008 child->
verts[i] = vertx[i];
2023 GLint cur = -1, prev = -1, i, v1 = 0, v2 = 0, flag = 1, prev0 = -1;
2026 GL2PSvertex *front_list = NULL, *back_list = NULL;
2029 GLshort front_count = 0, back_count = 0;
2031 for(i = 0; i <= prim->
numverts; i++){
2045 if(((prev == -1) || (prev == cur) || (prev == 0) || (cur == 0)) &&
2046 (i < prim->numverts)){
2051 front_list[front_count-1] = prim->
verts[v1];
2057 back_list[back_count-1] = prim->
verts[v1];
2063 front_list[front_count-1] = prim->
verts[v1];
2067 back_list[back_count-1] = prim->
verts[v1];
2071 else if((prev != cur) && (cur != 0) && (prev != 0)){
2080 plane, &front_list[front_count-1]);
2084 back_list[back_count-1] = front_list[front_count-1];
2124 if((*tree)->front != NULL){
2135 if((*tree)->back != NULL){
2141 if((*tree)->front != NULL){
2177 c[0] = c[1] = c[2] = 0.0F;
2178 for(i = 0; i < prim->
numverts; i++){
2185 for(i = 0; i < prim->
numverts; i++){
2186 if(prim->
boundary & (GLint)pow(2., i)){
2203 v[0] = c[0] - prim->
verts[i].
xyz[0];
2204 v[1] = c[1] - prim->
verts[i].
xyz[1];
2265 GLfloat ofactor, GLfloat ounits,
2266 GLushort pattern, GLint factor,
2267 GLfloat width, GLint linecap,
2268 GLint linejoin,
char boundary)
2278 prim->
offset = (char)offset;
2283 prim->
width = width;
2303 i = (GLint)(p[3] + 0.5);
2322 GLushort pattern = 0;
2324 GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0;
2325 GLint lcap = 0, ljoin = 0;
2326 GLfloat lwidth = 1.0F, psize = 1.0F, ofactor = 0.0F, ounits = 0.0F;
2339 switch((GLint)*current){
2340 case GL_POINT_TOKEN :
2347 pattern, factor, psize, lcap, ljoin, 0);
2349 case GL_LINE_TOKEN :
2350 case GL_LINE_RESET_TOKEN :
2360 pattern, factor, lwidth, lcap, ljoin, 0);
2362 case GL_POLYGON_TOKEN :
2363 count = (GLint)current[1];
2367 while(count > 0 && used > 0){
2375 if(GL_TRUE == boundary){
2376 if(!count && vtot == 2) flag = 1|2|4;
2377 else if(!count) flag = 2|4;
2378 else if(vtot == 2) flag = 1|2;
2384 ounits, pattern, factor, 1, lcap, ljoin,
2386 vertices[1] = vertices[2];
2392 case GL_BITMAP_TOKEN :
2393 case GL_DRAW_PIXEL_TOKEN :
2394 case GL_COPY_PIXEL_TOKEN :
2401 case GL_PASS_THROUGH_TOKEN :
2402 switch((GLint)current[1]){
2407 ofactor = current[1];
2410 ounits = current[1];
2425 pattern = (GLushort)current[1];
2428 factor = (GLint)current[1];
2448 lcap = (GLint)current[1];
2453 ljoin = (GLint)current[1];
2458 lwidth = current[1];
2489 current += 2; used -= 2;
2491 current += i; used -= i;
2494 current += 2; used -= 2;
2498 for(i = 1; i < 4; i++){
2499 for(v = 0; v < 3; v++){
2510 sizeoffloat =
sizeof(GLfloat);
2511 v = 2 * sizeoffloat;
2518 for(i = 0; i < vtot; i += sizeoffloat){
2519 current += 2; used -= 2;
2521 memcpy(&(((
char*)(node->
image->
pixels))[i + v]), &(current[2]), sizeoffloat);
2523 memcpy(&(((
char*)(node->
image->
pixels))[i + v]), &(current[2]), vtot - i);
2559 unsigned char h =
byte / 16;
2560 unsigned char l =
byte % 16;
2566 GLuint nbhex, nbyte, nrgb, nbits;
2567 GLuint row, col, ibyte, icase;
2568 GLfloat dr = 0., dg = 0., db = 0., fgrey;
2569 unsigned char red = 0, green = 0, blue = 0, b, grey;
2570 GLuint width = (GLuint)im->
width;
2571 GLuint height = (GLuint)im->
height;
2578 if((width <= 0) || (height <= 0))
return;
2587 gl2psPrintf(
"[ %d 0 0 -%d 0 %d ]\n", width, height, height);
2588 gl2psPrintf(
"{ currentfile picstr readhexstring pop }\n");
2590 for(row = 0; row < height; row++){
2591 for(col = 0; col < width; col++){
2593 fgrey = (0.30F * dr + 0.59F * dg + 0.11F * db);
2594 grey = (
unsigned char)(255. * fgrey);
2599 nbhex = width * height * 2;
2604 nbits = nrgb * nbit;
2606 if((nbyte * 8) != nbits) nbyte++;
2609 gl2psPrintf(
"[ %d 0 0 -%d 0 %d ]\n", width, height, height);
2610 gl2psPrintf(
"{ currentfile rgbstr readhexstring pop }\n");
2613 for(row = 0; row < height; row++){
2617 for(ibyte = 0; ibyte < nbyte; ibyte++){
2626 red = (
unsigned char)(3. * dr);
2627 green = (
unsigned char)(3. * dg);
2628 blue = (
unsigned char)(3. * db);
2639 red = (
unsigned char)(3. * dr);
2640 green = (
unsigned char)(3. * dg);
2641 blue = (
unsigned char)(3. * db);
2647 else if(icase == 2) {
2657 red = (
unsigned char)(3. * dr);
2658 green = (
unsigned char)(3. * dg);
2659 blue = (
unsigned char)(3. * db);
2666 else if(icase == 3) {
2675 red = (
unsigned char)(3. * dr);
2676 green = (
unsigned char)(3. * dg);
2677 blue = (
unsigned char)(3. * db);
2691 nbits = nrgb * nbit;
2693 if((nbyte * 8) != nbits) nbyte++;
2696 gl2psPrintf(
"[ %d 0 0 -%d 0 %d ]\n", width, height, height);
2697 gl2psPrintf(
"{ currentfile rgbstr readhexstring pop }\n");
2700 for(row = 0; row < height; row++){
2703 for(ibyte = 0; ibyte < nbyte; ibyte++){
2712 red = (
unsigned char)(15. * dr);
2713 green = (
unsigned char)(15. * dg);
2717 else if(icase == 2) {
2718 blue = (
unsigned char)(15. * db);
2726 red = (
unsigned char)(15. * dr);
2730 else if(icase == 3) {
2731 green = (
unsigned char)(15. * dg);
2732 blue = (
unsigned char)(15. * db);
2744 gl2psPrintf(
"[ %d 0 0 -%d 0 %d ]\n", width, height, height);
2745 gl2psPrintf(
"{ currentfile rgbstr readhexstring pop }\n");
2748 for(row = 0; row < height; row++){
2749 for(col = 0; col < width; col++){
2751 red = (
unsigned char)(255. * dr);
2753 green = (
unsigned char)(255. * dg);
2755 blue = (
unsigned char)(255. * db);
2766 GLsizei width, GLsizei height,
2767 const unsigned char *imagemap){
2770 if((width <= 0) || (height <= 0))
return;
2772 size = height + height * (width - 1) / 8;
2776 gl2psPrintf(
"%d %d scale\n%d %d\ntrue\n", width, height,width, height);
2777 gl2psPrintf(
"[ %d 0 0 -%d 0 %d ] {<", width, height);
2778 for(i = 0; i < size; i++){
2804 "%%%%Creator: GL2PS %d.%d.%d%s, %s\n"
2806 "%%%%CreationDate: %s"
2807 "%%%%LanguageLevel: 3\n"
2808 "%%%%DocumentData: Clean7Bit\n"
2816 "%%%%DocumentMedia: Default %d %d 0 () ()\n",
2825 "%%%%EndComments\n",
2849 "/gl2psdict 64 dict def gl2psdict begin\n"
2850 "/tryPS3shading %s def %% set to false to force subdivision\n"
2851 "/rThreshold %g def %% red component subdivision threshold\n"
2852 "/gThreshold %g def %% green component subdivision threshold\n"
2853 "/bThreshold %g def %% blue component subdivision threshold\n",
2858 "/C { setrgbcolor } BD\n"
2859 "/G { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add setgray } BD\n"
2860 "/W { setlinewidth } BD\n"
2861 "/LC { setlinecap } BD\n"
2862 "/LJ { setlinejoin } BD\n");
2864 gl2psPrintf(
"/FC { findfont exch /SH exch def SH scalefont setfont } BD\n"
2865 "/SW { dup stringwidth pop } BD\n"
2866 "/S { FC moveto show } BD\n"
2867 "/SBC{ FC moveto SW -2 div 0 rmoveto show } BD\n"
2868 "/SBR{ FC moveto SW neg 0 rmoveto show } BD\n"
2869 "/SCL{ FC moveto 0 SH -2 div rmoveto show } BD\n"
2870 "/SCC{ FC moveto SW -2 div SH -2 div rmoveto show } BD\n"
2871 "/SCR{ FC moveto SW neg SH -2 div rmoveto show } BD\n"
2872 "/STL{ FC moveto 0 SH neg rmoveto show } BD\n"
2873 "/STC{ FC moveto SW -2 div SH neg rmoveto show } BD\n"
2874 "/STR{ FC moveto SW neg SH neg rmoveto show } BD\n");
2879 "/SR { gsave FCT moveto rotate show grestore } BD\n"
2880 "/SBCR{ gsave FCT moveto rotate SW -2 div 0 rmoveto show grestore } BD\n"
2881 "/SBRR{ gsave FCT moveto rotate SW neg 0 rmoveto show grestore } BD\n"
2882 "/SCLR{ gsave FCT moveto rotate 0 SH -2 div rmoveto show grestore} BD\n");
2883 gl2psPrintf(
"/SCCR{ gsave FCT moveto rotate SW -2 div SH -2 div rmoveto show grestore} BD\n"
2884 "/SCRR{ gsave FCT moveto rotate SW neg SH -2 div rmoveto show grestore} BD\n"
2885 "/STLR{ gsave FCT moveto rotate 0 SH neg rmoveto show grestore } BD\n"
2886 "/STCR{ gsave FCT moveto rotate SW -2 div SH neg rmoveto show grestore } BD\n"
2887 "/STRR{ gsave FCT moveto rotate SW neg SH neg rmoveto show grestore } BD\n");
2889 gl2psPrintf(
"/P { newpath 0.0 360.0 arc closepath fill } BD\n"
2890 "/LS { newpath moveto } BD\n"
2891 "/L { lineto } BD\n"
2892 "/LE { lineto stroke } BD\n"
2893 "/T { newpath moveto lineto lineto closepath fill } BD\n");
2899 " /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
2900 " /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
2901 " /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
2902 " gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n"
2903 " /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n"
2904 " shfill grestore } BD\n");
2910 "/Tm { 3 -1 roll 8 -1 roll 13 -1 roll add add 3 div\n"
2912 " 3 -1 roll 7 -1 roll 11 -1 roll add add 3 div\n"
2914 " 3 -1 roll 6 -1 roll 9 -1 roll add add 3 div"
2924 " 4 index 15 index add 0.5 mul\n"
2925 " 4 index 15 index add 0.5 mul\n"
2926 " 4 index 15 index add 0.5 mul\n"
2927 " 4 index 15 index add 0.5 mul\n"
2928 " 4 index 15 index add 0.5 mul\n"
2929 " 5 copy 5 copy 25 15 roll\n");
2934 " 9 index 30 index add 0.5 mul\n"
2935 " 9 index 30 index add 0.5 mul\n"
2936 " 9 index 30 index add 0.5 mul\n"
2937 " 9 index 30 index add 0.5 mul\n"
2938 " 5 copy 5 copy 35 5 roll 25 5 roll 15 5 roll\n");
2943 " 4 index 10 index add 0.5 mul\n"
2944 " 4 index 10 index add 0.5 mul\n"
2945 " 4 index 10 index add 0.5 mul\n"
2946 " 4 index 10 index add 0.5 mul\n"
2947 " 5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n");
2951 gl2psPrintf(
" STnoshfill STnoshfill STnoshfill STnoshfill } BD\n");
2958 " 2 index 8 index sub abs rThreshold gt\n"
2960 " { 1 index 7 index sub abs gThreshold gt\n"
2962 " { dup 6 index sub abs bThreshold gt\n"
2964 " { 2 index 13 index sub abs rThreshold gt\n"
2966 " { 1 index 12 index sub abs gThreshold gt\n"
2968 " { dup 11 index sub abs bThreshold gt\n"
2970 " { 7 index 13 index sub abs rThreshold gt\n");
2972 " { 6 index 12 index sub abs gThreshold gt\n"
2974 " { 5 index 11 index sub abs bThreshold gt\n"
2989 " { /ST { STshfill } BD }\n"
2990 " { /ST { STnoshfill } BD }\n"
2992 "{ /ST { STnoshfill } BD }\n"
2998 "/DeviceRGB setcolorspace\n"
3002 "%%%%BeginPageSetup\n");
3016 "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
3029 gl2psPrintf(
"%g %g %g C\n", rgba[0], rgba[1], rgba[2]);
3043 for(i = 0; i < 3; i++)
3045 for(i = 0; i < 4; i++)
3051 int *nb,
int array[10])
3054 int on[8] = {0, 0, 0, 0, 0, 0, 0, 0};
3055 int off[8] = {0, 0, 0, 0, 0, 0, 0, 0};
3059 for(
n = 15;
n >= 0;
n--){
3060 tmp[
n] = (char)(pattern & 0x01);
3065 for(i = 0; i < 8; i++){
3066 while(
n < 16 && !tmp[
n]){ off[i]++;
n++; }
3067 while(
n < 16 && tmp[
n]){ on[i]++;
n++; }
3068 if(
n >= 15){ i++;
break; }
3077 for(
n = i - 1;
n >= 0;
n--){
3078 array[(*nb)++] = factor * on[
n];
3079 array[(*nb)++] = factor * off[
n];
3080 if(*nb == 10)
break;
3086 int len = 0, i,
n, array[10];
3094 if(!pattern || !factor){
3101 for(i = 0; i <
n; i++){
3168 newline ?
"LS" :
"L");
3174 gl2psPrintf(
"%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n",
3277 int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
3279 glRenderMode(GL_FEEDBACK);
3294 glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
3297 glGetIntegerv(GL_INDEX_CLEAR_VALUE, &idx);
3304 "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
3306 rgba[0], rgba[1], rgba[2],
3307 x, y, x+w, y, x+w, y+h, x, y+h);
3310 gl2psPrintf(
"newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
3312 x, y, x+w, y, x+w, y+h, x, y+h);
3352 "Encapsulated Postscript"
3379 strcpy(
name,
"untitled");
3386 "%% Creator: GL2PS %d.%d.%d%s, %s\n"
3388 "%% CreationDate: %s",
3396 "\\setlength{\\unitlength}{%gpt}\n"
3397 "\\begin{picture}(0,0)\n"
3398 "\\includegraphics[scale=%g]{%s}\n"
3399 "\\end{picture}%%\n"
3400 "%s\\begin{picture}(%d,%d)(0,0)\n",
3415 fprintf(
gl2ps->
stream,
"\\fontsize{%d}{0}\\selectfont",
3453 fprintf(
gl2ps->
stream,
"\\textcolor[rgb]{%g,%g,%g}{{%s}}",
3480 glRenderMode(GL_FEEDBACK);
3520#if defined(GL2PS_HAVE_ZLIB)
3522 return fprintf(
gl2ps->
stream,
"/Filter [/FlateDecode]\n");
3533 for(i = 0; i < 3; ++i){
3536 else if(rgba[i] < 1e-4 || rgba[i] > 1
e6)
3549 for(i = 0; i < 3; ++i){
3552 else if(rgba[i] < 1e-4 || rgba[i] > 1
e6)
3565 else if(lw < 1e-4 || lw > 1
e6)
3589 GLfloat
rad, crad, srad;
3591 if(text->
angle == 0.0F){
3601 rad = (GLfloat)(3.141593F * text->
angle / 180.0F);
3602 srad = (GLfloat)sin(
rad);
3603 crad = (GLfloat)cos(
rad);
3607 "%f %f %f %f %f %f Tm\n"
3610 cnt, text->
fontsize, crad, srad, -srad, crad, x, y, text->
str);
3619 GLfloat xbl, GLfloat ybl)
3621 if(text->
angle == 0.0F){
3632 GLfloat
pi = 3.141593F;
3633 GLfloat i = std::atan2(y - ybl, x - xbl);
3634 GLfloat r = std::sqrt((y - ybl) * (y - ybl) + (x - xbl) * (x - xbl));
3636 a = (GLfloat)(
pi * text->
angle / 180.0F);
3637 sa = (GLfloat)sin(a);
3638 ca = (GLfloat)cos(a);
3642 "%f %f %f %f %f %f Tm\n"
3647 xbl + r * (std::cos(i) - std::cos(i + a)), ybl + r * (std::sin(i) - std::sin(i+a)), text->
str);
3661 "%d 0 0 %d %f %f cm\n"
3698 GL2PSrgba lastrgba = {-1.0F, -1.0F, -1.0F, -1.0F};
3699 GLushort lastpattern = 0;
3700 GLint lastfactor = 0;
3701 GLfloat lastwidth = 1;
3702 GLint lastlinecap = 0;
3703 GLint lastlinejoin = 0;
3705 int lastTriangleWasNotSimpleWithSameColor = 0;
3731 if(lasttype != p->
type || lastwidth != p->
width ||
3745 lastwidth = p->
width;
3753 if(lasttype != p->
type || lastwidth != p->
width ||
3763 lastwidth = p->
width;
3770 lastTriangleWasNotSimpleWithSameColor =
3774 lastTriangleWasNotSimpleWithSameColor){
3855 int i, j, lastel, count;
3865 for(i = 0; i < count; ++i){
3879 for(j = 0; j <= lastel; ++j){
3903 for(j = 1; j <= lastel; ++j){
3912 prev->verts[1].xyz[0], prev->verts[1].xyz[1]);
3938 for(j = 0; j <= lastel; ++j){
3958 for(j = 0; j <= lastel; ++j){
3981 for(j = 0; j <= lastel; ++j){
4023 for(j = 0; j <= lastel; ++j){
4030 for(j = 0; j <= lastel; ++j){
4050 for(j = 0; j <= lastel; ++j){
4187 newtime = gmtime(&now);
4193 "/Creator (GL2PS %d.%d.%d%s, %s)\n"
4207 "/CreationDate (D:%d%02d%02d%02d%02d%02d)\n"
4210 newtime->tm_year+1900,
4253 "/Length 5 0 R\n" );
4289#if defined(GL2PS_HAVE_ZLIB)
4331#if defined(GL2PS_HAVE_ZLIB)
4373 "/MediaBox [%d %d %d %d]\n",
4384 "/ProcSet [/PDF /Text /ImageB /ImageC] %%/ImageI\n");
4422 "/Type /ExtGState\n"
4438 int (*
action)(
unsigned long data,
int size),
4439 GLfloat dx, GLfloat dy,
4440 GLfloat xmin, GLfloat ymin)
4445 double dmax = (double) ULONG_MAX;
4449 if(
sizeof(
unsigned long) == 8) dmax = dmax - 2048.;
4451 offs += (*action)(edgeflag, 1);
4457 offs += (*action)(0, 4);
4458 offs += (*action)(0, 4);
4461 diff = (vertex->
xyz[0] - xmin) / dx;
4466 imap = (
unsigned long)(diff * dmax);
4467 offs += (*action)(imap, 4);
4469 diff = (vertex->
xyz[1] - ymin) / dy;
4474 imap = (
unsigned long)(diff * dmax);
4475 offs += (*action)(imap, 4);
4484 int (*
action)(
unsigned long data,
int size))
4488 double dmax = (double) ULONG_MAX;
4491 if(
sizeof(
unsigned long) == 8) dmax = dmax - 2048.;
4493 imap = (
unsigned long)((vertex->
rgba[0]) * dmax);
4494 offs += (*action)(imap, 1);
4496 imap = (
unsigned long)((vertex->
rgba[1]) * dmax);
4497 offs += (*action)(imap, 1);
4499 imap = (
unsigned long)((vertex->
rgba[2]) * dmax);
4500 offs += (*action)(imap, 1);
4508 int (*
action)(
unsigned long data,
int size),
4513 double dmax = (double) ULONG_MAX;
4516 if(
sizeof(
unsigned long) == 8) dmax = dmax - 2048.;
4518 if(sigbyte != 8 && sigbyte != 16)
4523 imap = (
unsigned long)((vertex->
rgba[3]) * dmax);
4525 offs += (*action)(imap, sigbyte);
4533 GLfloat dx, GLfloat dy,
4534 GLfloat xmin, GLfloat ymin,
4535 int (*
action)(
unsigned long data,
int size),
4544 for(i = 0; i < 3; ++i){
4546 dx, dy, xmin, ymin);
4560 GLfloat *ymin, GLfloat *ymax,
4570 for(i = 0; i < cnt; ++i){
4571 for(j = 0; j < 3; ++j){
4572 if(*xmin > triangles[i].vertex[j].xyz[0])
4574 if(*xmax < triangles[i].vertex[j].xyz[0])
4576 if(*ymin > triangles[i].vertex[j].xyz[1])
4578 if(*ymax < triangles[i].vertex[j].xyz[1])
4592 int i, offs = 0, vertexbytes, done = 0;
4593 GLfloat xmin, xmax, ymin, ymax;
4597 vertexbytes = 1+4+4+1+1+1;
4600 vertexbytes = 1+4+4+1;
4603 vertexbytes = 1+4+4+2;
4607 vertexbytes = 1+4+4+1;
4618 "/BitsPerCoordinate 32 "
4619 "/BitsPerComponent %d "
4621 "/Decode [%f %f %f %f 0 1 %s] ",
4623 (
gray) ?
"/DeviceGray" :
"/DeviceRGB",
4625 xmin, xmax, ymin, ymax,
4626 (
gray) ?
"" :
"0 1 0 1");
4628#if defined(GL2PS_HAVE_ZLIB)
4632 for(i = 0; i < size; ++i)
4634 xmax-xmin, ymax-ymin, xmin, ymin,
4660 vertexbytes * 3 * size);
4661 for(i = 0; i < size; ++i)
4663 xmax-xmin, ymax-ymin, xmin, ymin,
4685 "/BBox [ %d %d %d %d ]\n"
4686 "/Group \n<<\n/S /Transparency /CS /DeviceRGB\n"
4693 ? (
int)strlen(
"/TrSh sh\n") + (int)log10((
double)childobj)+1
4694 : (
int)strlen(
"/TrSh0 sh\n");
4725 "/SMask << /S /Alpha /G %d 0 R >> ",
4753 int (*
action)(
unsigned long data,
int size),
4767 shift = (
sizeof(
unsigned long) - 1) * 8;
4769 for(y = 0; y < im->
height; ++y){
4770 for(x = 0; x < im->
width; ++x){
4773 (*action)((
unsigned long)(a * 255) << shift,
gray);
4776 (*action)((
unsigned long)(r * 255) << shift, 1);
4777 (*action)((
unsigned long)(
g * 255) << shift, 1);
4778 (*action)((
unsigned long)(b * 255) << shift, 1);
4793 int offs = 0, done = 0, sigbytes = 3;
4799 sigbytes =
gray / 8;
4809 "/BitsPerComponent 8\n",
4812 (
gray) ?
"/DeviceGray" :
"/DeviceRGB" );
4819#if defined(GL2PS_HAVE_ZLIB)
4869 "/Encoding /MacRomanEncoding\n"
4872 obj, fontnumber,
s->fontname);
4883 int offs = entryoffs;
4903 for(j = 0; j < size; ++j){
5008#if defined(GL2PS_HAVE_ZLIB)
5024 int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
5026 glRenderMode(GL_FEEDBACK);
5039 glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
5042 glGetIntegerv(GL_INDEX_CLEAR_VALUE, &idx);
5087 "Portable Document Format"
5101 for(i = 0; i <
n; i++){
5102 xyz[i][0] = verts[i].
xyz[0];
5105 for(j = 0; j < 4; j++)
5106 rgba[i][j] = verts[i].rgba[j];
5112 int r = (int)(255. * rgba[0]);
5113 int g = (int)(255. * rgba[1]);
5114 int b = (int)(255. * rgba[2]);
5115 int rc = (r < 0) ? 0 : (r > 255) ? 255 : r;
5116 int gc = (
g < 0) ? 0 : (
g > 255) ? 255 :
g;
5117 int bc = (b < 0) ? 0 : (b > 255) ? 255 : b;
5118 sprintf(str,
"#%2.2x%2.2x%2.2x", rc, gc, bc);
5123 int x, y, width, height;
5145 gl2psPrintf(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
5146 gl2psPrintf(
"<svg xmlns=\"http://www.w3.org/2000/svg\"\n");
5147 gl2psPrintf(
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
5148 " width=\"%dpt\" height=\"%dpt\" viewBox=\"%d %d %d %d\">\n",
5149 width, height, x, y, width, height);
5163 gl2psPrintf(
"<polygon fill=\"%s\" points=\"%d,%d %d,%d %d,%d %d,%d\"/>\n", col,
5188 if(rgba[0][3] < 1.0F)
gl2psPrintf(
"fill-opacity=\"%g\" ", rgba[0][3]);
5190 gl2psPrintf(
"points=\"%g,%g %g,%g %g,%g\"/>\n", xyz[0][0], xyz[0][1],
5191 xyz[1][0], xyz[1][1], xyz[2][0], xyz[2][1]);
5195 for(i = 0; i < 3; i++){
5196 xyz2[0][i] = xyz[0][i];
5197 xyz2[1][i] = 0.5F * (xyz[0][i] + xyz[1][i]);
5198 xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]);
5200 for(i = 0; i < 4; i++){
5201 rgba2[0][i] = rgba[0][i];
5202 rgba2[1][i] = 0.5F * (rgba[0][i] + rgba[1][i]);
5203 rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]);
5206 for(i = 0; i < 3; i++){
5207 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]);
5208 xyz2[1][i] = xyz[1][i];
5209 xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]);
5211 for(i = 0; i < 4; i++){
5212 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]);
5213 rgba2[1][i] = rgba[1][i];
5214 rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]);
5217 for(i = 0; i < 3; i++){
5218 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[2][i]);
5219 xyz2[1][i] = xyz[2][i];
5220 xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]);
5222 for(i = 0; i < 4; i++){
5223 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[2][i]);
5224 rgba2[1][i] = rgba[2][i];
5225 rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]);
5228 for(i = 0; i < 3; i++){
5229 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]);
5230 xyz2[1][i] = 0.5F * (xyz[1][i] + xyz[2][i]);
5231 xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]);
5233 for(i = 0; i < 4; i++){
5234 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]);
5235 rgba2[1][i] = 0.5F * (rgba[1][i] + rgba[2][i]);
5236 rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]);
5244 int i,
n, array[10];
5246 if(!pattern || !factor)
return;
5250 for(i = 0; i <
n; i++){
5263 for(i = 0; i < 3; i++)
5265 for(i = 0; i < 4; i++)
5272#if defined(GL2PS_HAVE_LIBPNG)
5284 sizeof(
unsigned char));
5291 gl2psPrintf(
"<image x=\"%g\" y=\"%g\" width=\"%d\" height=\"%d\"\n",
5293 gl2psPrintf(
"transform=\"matrix(%g,0,0,%g,%g,%g)\"\n",
5295 gl2psPrintf(
"xlink:href=\"data:image/png;base64,");
5303 (void) x; (void) y; (void) pixmap;
5305 "order to embed images in SVG streams");
5315 char lcap[7], ljoin[7];
5333 if(rgba[0][3] < 1.0F)
gl2psPrintf(
"fill-opacity=\"%g\" ", rgba[0][3]);
5335 xyz[0][0], xyz[0][1], 0.5 * prim->
width);
5364 gl2psPrintf(
"<polyline fill=\"none\" stroke=\"%s\" stroke-width=\"%g\" ",
5368 sprintf (lcap,
"%s",
"butt");
5371 sprintf (lcap,
"%s",
"round");
5374 sprintf (lcap,
"%s",
"square");
5379 sprintf (ljoin,
"%s",
"miter");
5382 sprintf (ljoin,
"%s",
"round");
5385 sprintf (ljoin,
"%s",
"bevel");
5388 gl2psPrintf(
"stroke-linecap=\"%s\" stroke-linejoin=\"%s\" ",
5390 if(rgba[0][3] < 1.0F)
gl2psPrintf(
"stroke-opacity=\"%g\" ", rgba[0][3]);
5392 gl2psPrintf(
"points=\"%g,%g ", xyz[0][0], xyz[0][1]);
5409 gl2psPrintf(
"<text fill=\"%s\" x=\"%g\" y=\"%g\" font-size=\"%d\" ",
5453 gl2psPrintf(
"font-family=\"Times\" font-weight=\"bold\">");
5455 gl2psPrintf(
"font-family=\"Times\" font-style=\"italic\">");
5457 gl2psPrintf(
"font-family=\"Times\" font-style=\"italic\" font-weight=\"bold\">");
5459 gl2psPrintf(
"font-family=\"Helvetica\" font-weight=\"bold\">");
5461 gl2psPrintf(
"font-family=\"Helvetica\" font-style=\"oblique\">");
5463 gl2psPrintf(
"font-family=\"Helvetica\" font-style=\"oblique\" font-weight=\"bold\">");
5465 gl2psPrintf(
"font-family=\"Courier\" font-weight=\"bold\">");
5467 gl2psPrintf(
"font-family=\"Courier\" font-style=\"oblique\">");
5469 gl2psPrintf(
"font-family=\"Courier\" font-style=\"oblique\" font-weight=\"bold\">");
5498 int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
5500 glRenderMode(GL_FEEDBACK);
5511 glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
5514 glGetIntegerv(GL_INDEX_CLEAR_VALUE, &idx);
5521 gl2psPrintf(
"<polygon fill=\"%s\" points=\"%d,%d %d,%d %d,%d %d,%d\" ", col,
5526 gl2psPrintf(
"shape-rendering=\"crispEdges\"/>\n");
5529 gl2psPrintf(
"<clipPath id=\"cp%d%d%d%d\">\n", x, y, w, h);
5530 gl2psPrintf(
" <polygon points=\"%d,%d %d,%d %d,%d %d,%d\"/>\n",
5536 gl2psPrintf(
"<g clip-path=\"url(#cp%d%d%d%d)\">\n", x, y, w, h);
5564 "Scalable Vector Graphics"
5577 fprintf(
gl2ps->
stream,
"\\color[rgb]{%f,%f,%f}\n", rgba[0], rgba[1], rgba[2]);
5589 "%% Creator: GL2PS %d.%d.%d%s, %s\n"
5591 "%% CreationDate: %s",
5600 "\\pgfpathrectanglecorners{"
5601 "\\pgfpoint{%dpt}{%dpt}}{\\pgfpoint{%dpt}{%dpt}}\n"
5602 "\\pgfusepath{fill}\n",
5610 int i,
n, array[10];
5618 if(!pattern || !factor){
5625 for(i = 0; i <
n; i++) fprintf(
gl2ps->
stream,
"{%dpt}", array[i]);
5642 default :
return "south west";
5657 "\\pgfpathrectangle{\\pgfpoint{%fpt}{%fpt}}"
5658 "{\\pgfpoint{%fpt}{%fpt}}\n\\pgfusepath{fill}\n",
5673 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"buttcap");
5676 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"roundcap");
5679 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"rectcap");
5687 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"miterjoin");
5690 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"roundjoin");
5693 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"beveljoin");
5699 "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n"
5700 "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
5701 "\\pgfusepath{stroke}\n",
5708 fprintf(
gl2ps->
stream,
"\\pgfsetlinewidth{0.01pt}\n");
5714 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"buttcap");
5717 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"roundcap");
5720 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"rectcap");
5728 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"miterjoin");
5731 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"roundjoin");
5734 fprintf(
gl2ps->
stream,
"\\pgfset%s\n",
"beveljoin");
5740 "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n"
5741 "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
5742 "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n"
5744 "\\pgfusepath{fill,stroke}\n",
5750 fprintf(
gl2ps->
stream,
"{\n\\pgftransformshift{\\pgfpoint{%fpt}{%fpt}}\n",
5756 fprintf(
gl2ps->
stream,
"\\pgfnode{rectangle}{%s}{\\fontsize{%d}{0}\\selectfont",
5760 fprintf(
gl2ps->
stream,
"\\textcolor[rgb]{%g,%g,%g}{{%s}}",
5764 fprintf(
gl2ps->
stream,
"}{}{\\pgfusepath{discard}}");
5791 int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3];
5793 glRenderMode(GL_FEEDBACK);
5805 glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
5808 glGetIntegerv(GL_INDEX_CLEAR_VALUE, &idx);
5816 "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}"
5817 "{\\pgfpoint{%dpt}{%dpt}}\n"
5818 "\\pgfusepath{fill}\n",
5823 "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}"
5824 "{\\pgfpoint{%dpt}{%dpt}}\n"
5825 "\\pgfusepath{clip}\n",
5851 "PGF Latex Graphics"
5879 for(i = 0; i < prim->
numverts; i++){
5898 used = glRenderMode(GL_RENDER);
5973 "GL2PS_DRAW_BACKGROUND are incompatible.");
5978 "GL2PS_USE_CURRENT_VIEWPORT are incompatible.");
5983 "option GL2PS_NO_BLENDING.");
5986 if (colormode != GL_RGBA) {
6003 GLint viewport[4], GLint format, GLint sort,
6004 GLint options, GLint colormode,
6006 GLint nr, GLint ng, GLint nb, GLint buffersize,
6007 FILE *stream,
const char *filename)
6071 for(i = 0; i < 4; i++){
6090 for(i = 0; i < 3; i++){
6093 for(i = 0; i < 4; i++){
6113 : glIsEnabled(GL_BLEND);
6129 if(!colorsize || !colormap){
6138 glGetIntegerv(GL_INDEX_CLEAR_VALUE, &idx);
6184 glRenderMode(GL_FEEDBACK);
6270 GLshort fontsize, GLint alignment, GLfloat
angle,
6274 color, GL_FALSE, 0, 0);
6283 GLshort fontsize, GLint alignment, GLfloat
angle,
6284 GL2PSrgba color, GLfloat blx, GLfloat bly)
6287 color, GL_TRUE, blx, bly);
6291 GLshort fontsize, GLint alignment, GLfloat
angle)
6299 NULL, GL_FALSE, 0, 0);
6313 GLint xorig, GLint yorig,
6314 GLenum format, GLenum type,
6319 GLfloat
pos[4], zoom_x, zoom_y;
6325 if((width <= 0) || (height <= 0))
return GL2PS_ERROR;
6329 if((format != GL_RGB && format != GL_RGBA) || type != GL_FLOAT){
6331 "GL_RGB/GL_RGBA, GL_FLOAT pixels");
6345 glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid);
6347 glGetFloatv(GL_CURRENT_RASTER_POSITION,
pos);
6348 glGetFloatv(GL_ZOOM_X, &zoom_x);
6349 glGetFloatv(GL_ZOOM_Y, &zoom_y);
6374 glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->
verts[0].
rgba);
6391 size = height * width * 3;
6393 piv = (
const GLfloat*)pixels;
6394 for(i = 0; i < size; ++i, ++piv){
6401 size = height * width * 4;
6408 size = height * width * 3;
6428 const unsigned char *imagemap){
6430 int sizeoffloat =
sizeof(GLfloat);
6434 if((width <= 0) || (height <= 0))
return GL2PS_ERROR;
6436 size = height + height * ((width - 1) / 8);
6441 glPassThrough((GLfloat)width);
6442 glPassThrough((GLfloat)height);
6443 for(i = 0; i < size; i += sizeoffloat){
6444 const float *value = (
const float*)imagemap;
6445 glPassThrough(*value);
6446 imagemap += sizeoffloat;
6461 glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &tmp2);
6462 glPassThrough(tmp2);
6463 glGetFloatv(GL_POLYGON_OFFSET_UNITS, &tmp2);
6464 glPassThrough(tmp2);
6471 glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp);
6472 glPassThrough((GLfloat)tmp);
6473 glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp);
6474 glPassThrough((GLfloat)tmp);
6517 glPassThrough(value);
6527 glPassThrough(value);
6537 glPassThrough(value);
6547 glPassThrough(value);
6560 glPassThrough((GLfloat)sfactor);
6562 glPassThrough((GLfloat)dfactor);
6597 return "Unknown format";
6605 return "Unknown format";
static const G4double e6[46]
G4double epsilon(G4double density, G4double temperature)
static const G4double pos
static const G4double alpha
static constexpr double L
static constexpr double gray
static constexpr double rad
static constexpr double s
static constexpr double g
static constexpr double pi
static const G4double angle[DIMMOTT]
#define gl2psListEncodeBase64
#define gl2psUserWritePNG
#define gl2psReallocCompress
#define gl2psAllocCompress
#define gl2psUserFlushPNG
#define gl2psSetupCompress
#define gl2psEncodeBase64Block
#define gl2psFreeCompress
#define gl2psConvertPixmapToPNG
#define gl2psWriteBigEndianCompress
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
static void gl2psPDFgroupObjectInit(GL2PSpdfgroup *gro)
#define GL2PS_END_STIPPLE_TOKEN
#define GL2PS_BEGIN_OFFSET_TOKEN
static void gl2psPrintTeXFooter(void)
static void gl2psListSort(GL2PSlist *list, int(*fcmp)(const void *a, const void *b))
static void gl2psPrintPGFHeader(void)
static void gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane)
static GLfloat gl2psNorm(GLfloat *a)
static GL2PSbackend * gl2psbackends[]
#define GL2PS_LINE_CAP_TOKEN
#define GL2PS_DST_BLEND_TOKEN
static GLboolean gl2psSameColorThreshold(int n, GL2PSrgba rgba[], GL2PSrgba threshold)
static void gl2psAssignTriangleProperties(GL2PStriangle *t)
static GL2PSbackend gl2psPS
static void gl2psPrintTeXPrimitive(void *data)
static GL2PSbackend gl2psTEX
GL2PSDLL_API GLint gl2psLineJoin(GLint value)
GL2PSDLL_API GLint gl2psEndViewport(void)
static GL2PScontext * gl2ps
static void gl2psPrintPostScriptFooter(void)
static void gl2psDivideQuad(GL2PSprimitive *quad, GL2PSprimitive **t1, GL2PSprimitive **t2)
GL2PSDLL_API const char * gl2psGetFormatDescription(GLint format)
static int gl2psPrintPDFOpenPage(void)
static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2)
static const char * gl2psPGFTextAlignment(int align)
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels)
static void gl2psPrintTeXBeginViewport(GLint viewport[4])
static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin, int(*action)(unsigned long data, int size), int gray)
static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, int size, int gray)
static int gl2psListNbr(GL2PSlist *list)
GL2PSDLL_API GLint gl2psLineCap(GLint value)
static GLboolean gl2psSamePosition(GL2PSxyz p1, GL2PSxyz p2)
static void gl2psSplitPrimitive2D(GL2PSprimitive *prim, GL2PSplane plane, GL2PSprimitive **front, GL2PSprimitive **back)
static int gl2psPrintPDFPages(void)
static GLint gl2psPrintPrimitives(void)
static GLfloat gl2psPsca(GLfloat *a, GLfloat *b)
#define GL2PS_BEGIN_STIPPLE_TOKEN
GL2PSDLL_API const char * gl2psGetFileExtension(GLint format)
static void gl2psPrintPostScriptFinalPrimitive(void)
static void gl2psPrintPGFPrimitive(void *data)
static void gl2psEndPostScriptLine(void)
static int gl2psPDFgroupListWriteXObjectResources(void)
static void gl2psFreePrimitive(void *data)
static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, GL2PSprimitive **front, GL2PSprimitive **back)
static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, int(*action)(unsigned long data, int size), GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin)
static GLshort gl2psGetIndex(GLshort i, GLshort num)
static void gl2psInitTriangle(GL2PStriangle *t)
static void gl2psPrintTeXHeader(void)
static void gl2psPDFgroupListWriteMainStream(void)
static void gl2psAddPrimitiveInList(GL2PSprimitive *prim, GL2PSlist *list)
static int gl2psPrintPDFShaderStreamDataRGB(GL2PSvertex *vertex, int(*action)(unsigned long data, int size))
static int gl2psPDFgroupListWriteFontResources(void)
static void gl2psAdaptVertexForBlending(GL2PSvertex *v)
static void gl2psRescaleAndOffset(void)
static int gl2psPrintPDFCompressorType(void)
static GLint gl2psPrintPostScriptEndViewport(void)
static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, GLshort i, GLshort j)
static void gl2psPrintSVGFooter(void)
GL2PSDLL_API GLint gl2psPointSize(GLfloat value)
static void gl2psFreeBspImageTree(GL2PSbsptree2d **tree)
static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim)
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str)
GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle, GL2PSrgba color, GLfloat blx, GLfloat bly)
static int gl2psOpenPDFDataStreamWritePreface(void)
static int gl2psPDFgroupListWriteShaderResources(void)
static GLboolean gl2psCheckOptions(GLint options, GLint colormode)
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)
static GLboolean gl2psGreater(GLfloat f1, GLfloat f2)
static void gl2psPrintPDFPrimitive(void *data)
static int gl2psCompareDepth(const void *a, const void *b)
static void gl2psSetLastColor(GL2PSrgba rgba)
static int gl2psPrintPDFShaderSimpleExtGS(int obj, GLfloat alpha)
static void * gl2psListPointer(GL2PSlist *list, GLint idx)
#define GL2PS_POINT_SIZE_TOKEN
static void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GL2PSimage *im)
static void gl2psPrintPGFDash(GLushort pattern, GLint factor)
static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon, GLboolean(*compare)(GLfloat f1, GLfloat f2), void(*action)(void *data), int inverse)
static void gl2psResetLineProperties(void)
static void gl2psPrintPGFBeginViewport(GLint viewport[4])
GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor)
static void * gl2psRealloc(void *ptr, size_t size)
#define GL2PS_END_BLEND_TOKEN
static void gl2psPrintPostScriptPrimitive(void *data)
static void gl2psFreePixmap(GL2PSimage *im)
static void gl2psListDelete(GL2PSlist *list)
GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, const GLfloat position[3], const unsigned char *imagemap)
static int gl2psPrintPostScriptDash(GLushort pattern, GLint factor, const char *str)
static void gl2psComputeTightBoundingBox(void *data)
static void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives)
static int gl2psPDFgroupListWriteGStateResources(void)
static void gl2psPrintGzipHeader(void)
GL2PSDLL_API GLint gl2psSetOptions(GLint options)
static void gl2psCutEdge(GL2PSvertex *a, GL2PSvertex *b, GL2PSplane plane, GL2PSvertex *c)
static GLboolean gl2psLess(GLfloat f1, GLfloat f2)
static GLint gl2psGetVertex(GL2PSvertex *v, GLfloat *p)
GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle, GL2PSrgba color)
static int gl2psPrintPDFText(int obj, GL2PSstring *s, int fontnumber)
static GLint gl2psCheckPoint(GL2PSxyz point, GL2PSplane plane)
#define GL2PS_SRC_BLEND_TOKEN
static void gl2psPvec(GLfloat *a, GLfloat *b, GLfloat *c)
static void * gl2psMalloc(size_t size)
static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, GLfloat *ymin, GLfloat *ymax, GL2PStriangle *triangles, int cnt)
static void gl2psPrintSVGPrimitive(void *data)
static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, GL2PSxyz *xyz, GL2PSrgba *rgba)
static GL2PSimage * gl2psCopyPixmap(GL2PSimage *im)
static GLint gl2psPrintSVGEndViewport(void)
GL2PSDLL_API GLint gl2psDisable(GLint mode)
static void gl2psSVGGetColorString(GL2PSrgba rgba, char str[32])
static int gl2psPrintPDFInfo(void)
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4])
static int gl2psTrianglesFirst(const void *a, const void *b)
static void gl2psBuildPolygonBoundary(GL2PSbsptree *tree)
static GLint gl2psCheckPrimitive(GL2PSprimitive *prim, GL2PSplane plane)
static void gl2psPrintSVGHeader(void)
static void gl2psFreeBspTree(GL2PSbsptree **tree)
static void gl2psSortOutTrianglePDFgroup(GL2PSpdfgroup *gro)
static void gl2psPrintTeXFinalPrimitive(void)
static void gl2psListAssignSortIds(GL2PSlist *list)
GL2PSDLL_API GLint gl2psGetFileFormat()
static void gl2psPrintPGFFinalPrimitive(void)
static int gl2psPrintPDFDataStreamLength(int val)
static void gl2psPrintPDFFooter(void)
#define GL2PS_POINT_INFRONT
static void gl2psFree(void *ptr)
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)
static GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root)
static GLint gl2psAddText(GLint type, const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle, GL2PSrgba color, GLboolean setblpos, GLfloat blx, GLfloat bly)
static GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree)
static void gl2psListAction(GL2PSlist *list, void(*action)(void *data))
#define GL2PS_IMAGEMAP_TOKEN
#define GL2PS_BEGIN_BLEND_TOKEN
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle)
static GLint gl2psPrintTeXEndViewport(void)
static int gl2psPDFgroupListWriteObjects(int entryoffs)
#define GL2PS_END_OFFSET_TOKEN
#define GL2PS_ZOFFSET_LARGE
static GL2PSstring * gl2psCopyText(GL2PSstring *t)
static void gl2psEndSVGLine(void)
GL2PSDLL_API GLint gl2psEndPage(void)
static void gl2psAddBoundaryInList(GL2PSprimitive *prim, GL2PSlist *list)
GL2PSDLL_API GLint gl2psSorting(GLint mode)
static void gl2psPrintPostScriptImagemap(GLfloat x, GLfloat y, GLsizei width, GLsizei height, const unsigned char *imagemap)
static void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim, GL2PSbsptree2d **tree)
static void gl2psPutPDFSpecial(int prim, int sec, GL2PSstring *text)
static void gl2psMsg(GLint level, const char *fmt,...)
static void gl2psPDFgroupListInit(void)
static GLint gl2psPrintPDFEndViewport(void)
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize)
#define GL2PS_LINE_JOIN_TOKEN
GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba)
static void gl2psPrintSVGSmoothTriangle(GL2PSxyz xyz[3], GL2PSrgba rgba[3])
static int gl2psPrintPDFLineCap(GLint lc)
static void gl2psPrintPDFHeader(void)
GL2PSDLL_API GLint gl2psEnable(GLint mode)
static void gl2psListAdd(GL2PSlist *list, void *data)
static int gl2psPrintPDFStrokeColor(GL2PSrgba rgba)
static void gl2psPrintPostScriptHeader(void)
static void gl2psPrintSVGFinalPrimitive(void)
static void gl2psAddInImageTree(void *data)
static int gl2psPrintf(const char *fmt,...)
static int gl2psClosePDFDataStream(void)
static void gl2psPDFgroupListDelete(void)
static int gl2psPrintPDFLineWidth(GLfloat lw)
static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap)
static int gl2psPrintPDFCatalog(void)
static GL2PSprimitive * gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent, GLshort numverts, GL2PSvertex *vertx)
GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling)
static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y)
static void gl2psPutPDFTextBL(GL2PSstring *text, int cnt, GLfloat x, GLfloat y, GLfloat xbl, GLfloat ybl)
static GLint gl2psPrintPGFEndViewport(void)
static void gl2psFreeText(GL2PSstring *text)
GL2PSDLL_API GLint gl2psForceRasterPos(GL2PSvertex *vert)
static int gl2psPrintPDFPixmap(int obj, int childobj, GL2PSimage *im, int gray)
static GL2PSbackend gl2psPGF
static void gl2psPrintPostScriptBeginViewport(GLint viewport[4])
static void gl2psListRealloc(GL2PSlist *list, GLint n)
#define GL2PS_IN_FRONT_OF
static void gl2psPrintPostScriptColor(GL2PSrgba rgba)
static void gl2psListActionInverse(GL2PSlist *list, void(*action)(void *data))
static void gl2psPrintPDFFinalPrimitive(void)
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value)
static void gl2psCreateSplitPrimitive(GL2PSprimitive *parent, GL2PSplane plane, GL2PSprimitive *child, GLshort numverts, GLshort *index0, GLshort *index1)
static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor)
static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, GLfloat *red, GLfloat *green, GLfloat *blue)
static void gl2psPrintPDFBeginViewport(GLint viewport[4])
static GL2PSprimitive * gl2psCopyPrimitive(GL2PSprimitive *p)
static void gl2psPDFstacksInit(void)
static void gl2psFreeImagemap(GL2PSimagemap *list)
static GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane)
static int gl2psPrintPDFLineJoin(GLint lj)
static void gl2psPrintGzipFooter(void)
static int gl2psPrintPDFShaderExtGS(int obj, int childobj)
static void gl2psGetNormal(GLfloat *a, GLfloat *b, GLfloat *c)
static void gl2psPrintSVGBeginViewport(GLint viewport[4])
static int gl2psOpenPDFDataStream(void)
static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, int(*action)(unsigned long data, int size), int sigbyte)
static void gl2psPrintSVGDash(GLushort pattern, GLint factor)
#define GL2PS_BEGIN_BOUNDARY_TOKEN
static void gl2psParseFeedbackBuffer(GLint used)
static void gl2psPrintPGFColor(GL2PSrgba rgba)
static int gl2psPrintPDFShaderMask(int obj, int childobj)
static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im, int(*action)(unsigned long data, int size), int gray)
static int gl2psPrintPDFFillColor(GL2PSrgba rgba)
static void gl2psParseStipplePattern(GLushort pattern, GLint factor, int *nb, int array[10])
static GL2PSbackend gl2psPDF
static int gl2psWriteBigEndian(unsigned long data, int bytes)
static GL2PSbackend gl2psSVG
static void gl2psListReset(GL2PSlist *list)
#define GL2PS_END_BOUNDARY_TOKEN
#define GL2PS_DRAW_PIXELS_TOKEN
static GL2PSlist * gl2psListCreate(GLint n, GLint incr, GLint size)
static int gl2psPrintPDFGSObject(void)
static void gl2psPutPDFImage(GL2PSimage *image, int cnt, GLfloat x, GLfloat y)
static void gl2psWriteByte(unsigned char byte)
static void gl2psResetPostScriptColor(void)
static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane)
GL2PSDLL_API GLint gl2psGetOptions(GLint *options)
static GL2PSbackend gl2psEPS
static int gl2psPDFgroupListWriteVariableResources(void)
static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p, GLboolean assignprops)
#define GL2PS_POINT_COINCIDENT
#define GL2PS_LINE_WIDTH_TOKEN
static void gl2psPrintPGFFooter(void)
static GLint gl2psGetPlaneFromPoints(GL2PSxyz a, GL2PSxyz b, GL2PSplane plane)
#define GL2PS_UNINITIALIZED
#define GL2PS_TIGHT_BOUNDING_BOX
#define GL2PS_LINE_CAP_SQUARE
#define GL2PS_LINE_JOIN_MITER
#define GL2PS_IMAGEMAP_VISIBLE
#define GL2PS_SIMPLE_SORT
#define GL2PS_NO_BLENDING
#define GL2PS_IMAGEMAP_WRITTEN
#define GL2PS_NO_OPENGL_CONTEXT
#define GL2PS_SIMPLE_LINE_OFFSET
#define GL2PS_LINE_CAP_ROUND
#define GL2PS_NO_TEX_FONTSIZE
#define GL2PS_OCCLUSION_CULL
#define GL2PS_PATCH_VERSION
#define GL2PS_LINE_JOIN_BEVEL
#define GL2PS_LINE_STIPPLE
#define GL2PS_POLYGON_BOUNDARY
#define GL2PS_LINE_CAP_BUTT
#define GL2PS_MAJOR_VERSION
#define GL2PS_POLYGON_OFFSET_FILL
#define GL2PS_DRAW_BACKGROUND
#define GL2PS_NO_PS3_SHADING
#define GL2PS_EXTRA_VERSION
#define GL2PS_MINOR_VERSION
#define GL2PS_LINE_JOIN_ROUND
#define GL2PS_NO_FEEDBACK
#define GL2PS_USE_CURRENT_VIEWPORT
const char * name(G4int ptype)
void(* printFinalPrimitive)(void)
const char * file_extension
GLint(* endViewport)(void)
void(* printPrimitive)(void *data)
void(* beginViewport)(GLint viewport[4])
void(* printFooter)(void)
void(* printHeader)(void)
GLboolean zerosurfacearea
GL2PSimagemap * imagemap_head
GL2PSimagemap * imagemap_tail
GL2PSprimitive * primitivetoadd
GL2PSbsptree2d * imagetree
GL2PSlist * auxprimitives
union GL2PSprimitive::@106 data
#define Z_DEFAULT_COMPRESSION