=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/term/Attic/tgif.trm,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gnuplot/term/Attic/tgif.trm 2000/01/22 14:16:30 1.1.1.2 +++ OpenXM_contrib/gnuplot/term/Attic/tgif.trm 2003/09/15 07:09:39 1.1.1.3 @@ -1,11 +1,8 @@ -/*{{{}}}*/ -/***************************************************************************/ -/* */ -/* $Id: tgif.trm,v 1.1.1.2 2000/01/22 14:16:30 maekawa Exp $ */ -/* */ -/***************************************************************************/ -/* GNUPLOT - tgif.trm */ +/* + * $Id: tgif.trm,v 1.1.1.3 2003/09/15 07:09:39 ohara Exp $ + */ +/* GNUPLOT - tgif.trm */ /*[ * Copyright 1990 - 1993, 1998 @@ -60,8 +57,10 @@ /* PostScript terminal */ /* - I left the %.1f format for pixel positions, but I think */ /* Tgif does only calculate with integer positions */ +/* */ +/* Modified 07 July 2000 by Ian MacPhedran */ +/* - added PM3D support */ - /***************************************************************************/ /*}}} */ @@ -88,6 +87,12 @@ TERM_PUBLIC void TGIF_point __PROTO((unsigned int ux, TERM_PUBLIC void TGIF_arrow __PROTO((unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head)); TERM_PUBLIC int TGIF_set_font __PROTO((char *font)); TERM_PUBLIC void TGIF_set_pointsize __PROTO((double size)); +#ifdef PM3D +TERM_PUBLIC int TGIF_make_palette (t_sm_palette *); +/* TERM_PUBLIC void TGIF_previous_palette (void); */ +TERM_PUBLIC void TGIF_set_color (double); +TERM_PUBLIC void TGIF_filled_polygon (int, gpiPoint *); +#endif /* PM3D */ /*}}} */ /* default length for static strings */ #define TGIF_STRLEN_MAX 255 @@ -113,7 +118,17 @@ TERM_PUBLIC void TGIF_set_pointsize __PROTO((double si #define TGIF_VTIC (TGIF_YMAX/80) #define TGIF_HTIC (TGIF_YMAX/80) +#ifdef PM3D +static int TGIF_palette_set = FALSE; /* PM3D Palette Set ? */ +static int TGIF_palette_size = 128; /* Number of colours in palette */ +/* unused (joze) */ +#if 0 +static int TGIF_palette_offst = 32; /* Offset from zero for user colours */ +#endif +static char TGIF_colours[128][8]; /* Colours */ +#endif /* PM3D */ + #define TGIF_MAXPOLY 100 /*}}} */ #define GOT_TGIF_PROTO @@ -165,18 +180,21 @@ static unsigned int uTextAngle[] = /* NL: Modified first value to 2 from 3 */ static unsigned int uLineThick[] = { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static unsigned int uLineStyle[] = { 0, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0 }; -static char *psColors[] = -{ - "black", "black", /* border and x/y-zero-axes */ - "red", "green", "blue", "magenta", "cyan", "yellow", - "DarkSeaGreen", "HotPink", "black", "coral"}; +static char *psColors[] = { + "black", "black", /* border and x/y-zero-axes */ + "red", "green", "blue", "magenta", "cyan", "yellow", + "DarkSeaGreen", "HotPink", "black", "coral" +}; #if 0 /* HBB: unused */ -static char *psFonts[] = -{"Times-Roman", "Courier", "Helvetica", "NewCenturySchlbk-Roman", "Symbol", NULL}; +static char *psFonts[] = { + "Times-Roman", "Courier", "Helvetica", "NewCenturySchlbk-Roman", + "Symbol", NULL +}; -static unsigned int psFontSizes[] = -{ 8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34, 40, 45, 50 }; +static unsigned int psFontSizes[] = { + 8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34, 40, 45, 50 +}; #endif static int iTgifPolyCount; @@ -193,7 +211,8 @@ static void TGIF_flush_poly __PROTO((void)); /*}}} */ /***************************************************************************/ -static void TGIF_flush_poly() +static void +TGIF_flush_poly() { int i; @@ -221,7 +240,8 @@ static void TGIF_flush_poly() } /* TGIF_flush_poly */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_options() +TERM_PUBLIC void +TGIF_options() { struct value a, b; @@ -355,7 +375,8 @@ TERM_PUBLIC void TGIF_options() } /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_init() +TERM_PUBLIC void +TGIF_init() { if (multiplot) { @@ -371,18 +392,22 @@ TERM_PUBLIC void TGIF_init() fprintf(gpoutfile, "\ %%TGIF 2.15-p7\n\ state(%d,30,%u,0,0,%u,16,1,9,1,1,0,0,0,0,1,0,'%s',0,%u,0,0,1,10,0,0,1,1,0,16,0,0,1,1,1).\n\ -%%\n%% @(#)$Header: /home/cvs/OpenXM_contrib/gnuplot/term/Attic/tgif.trm,v 1.1.1.2 2000/01/22 14:16:30 maekawa Exp $\n%% %%W%%\n%%\n\ +%%\n%% @(#)$Header: /home/cvs/OpenXM_contrib/gnuplot/term/Attic/tgif.trm,v 1.1.1.3 2003/09/15 07:09:39 ohara Exp $\n%% %%W%%\n%%\n\ page(1,\"\").\n", TgifPortrait ? 0 : 1, uActResolution, uActZoom, sActFont, uActFontSize); eTgifState = NEWPOLY; iTgifPolyCount = 0; uTgifPlotCount = 0; uActPage = 1; +#ifdef PM3D + TGIF_palette_set = FALSE; /* PM3D Palette Set ? */ +#endif /* PM3D */ } /* TGIF_init */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_graphics() +TERM_PUBLIC void +TGIF_graphics() { TGIF_flush_poly(); @@ -401,7 +426,7 @@ TERM_PUBLIC void TGIF_graphics() if (uTgifPlotCount < uTgifPlotsPerPage) uTgifPlotCount++; else { - fprintf(stderr, "error: number of plots > plots per page\n"); + fputs("error: number of plots > plots per page\n", stderr); return; } @@ -438,7 +463,8 @@ TERM_PUBLIC void TGIF_graphics() } /* TGIF_graphics */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_text() +TERM_PUBLIC void +TGIF_text() { TGIF_flush_poly(); @@ -447,7 +473,8 @@ TERM_PUBLIC void TGIF_text() /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_reset() +TERM_PUBLIC void +TGIF_reset() { TGIF_flush_poly(); iTgifPolyCount = 0; @@ -462,7 +489,8 @@ TERM_PUBLIC void TGIF_reset() } /* TGIF_reset */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_linetype(linetype) +TERM_PUBLIC void +TGIF_linetype(linetype) int linetype; { unsigned int ult; @@ -491,7 +519,8 @@ int linetype; } /* TGIF_linetype */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_move(ux, uy) +TERM_PUBLIC void +TGIF_move(ux, uy) unsigned int ux, uy; { @@ -506,7 +535,8 @@ unsigned int ux, uy; } /* TGIF_move */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_vector(ux, uy) +TERM_PUBLIC void +TGIF_vector(ux, uy) unsigned int ux, uy; { @@ -535,7 +565,8 @@ unsigned int ux, uy; } /* TGIF_vector */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_arrow(sx, sy, ex, ey, head) +TERM_PUBLIC void +TGIF_arrow(sx, sy, ex, ey, head) unsigned int sx, sy, ex, ey; TBOOLEAN head; { @@ -549,10 +580,14 @@ TBOOLEAN head; if (head) { - fprintf(gpoutfile, "poly('%s',%d,[\n\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n", + fprintf(gpoutfile, "\ +poly('%s',%d,[\n\ +\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n", sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle); } else { - fprintf(gpoutfile, "poly('%s',%d,[\n\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n", + fprintf(gpoutfile, "\ +poly('%s',%d,[\n\ +\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n", sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle); } @@ -566,7 +601,8 @@ TBOOLEAN head; } /* TGIF_arrow */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_put_text(ux, uy, str) +TERM_PUBLIC void +TGIF_put_text(ux, uy, str) unsigned int ux, uy; char *str; { @@ -585,9 +621,10 @@ char *str; return; - fprintf(gpoutfile, - "text('%s',%u,%u,'%s',0,%u,1,%u,%u,1,55,119,%u,0,15,4,0,0,0,0,[\n\t\"%s\"]).\n", - sActColor, x, y, sActFont, uActFontSize, uActJust, uActAngle, uActNr, str); + fprintf(gpoutfile, "\ +text('%s',%u,%u,'%s',0,%u,1,%u,%u,1,55,119,%u,0,15,4,0,0,0,0,[\n\t\"%s\"]).\n", + sActColor, x, y, sActFont, uActFontSize, uActJust, uActAngle, + uActNr, str); uActNr += 2; @@ -598,7 +635,8 @@ char *str; } /* TGIF_put_text */ /*}}} */ /***************************************************************************/ -TERM_PUBLIC int TGIF_text_angle(ang) +TERM_PUBLIC int +TGIF_text_angle(ang) int ang; { uActAngle = uTextAngle[ang]; /* 0=waag. 1=senkrecht */ @@ -607,7 +645,8 @@ int ang; /*}}} */ /***************************************************************************/ -TERM_PUBLIC int TGIF_justify_text(mode) +TERM_PUBLIC int +TGIF_justify_text(mode) enum JUSTIFY mode; { uActJust = mode; @@ -616,11 +655,12 @@ enum JUSTIFY mode; /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_point(ux, uy, number) +TERM_PUBLIC void +TGIF_point(ux, uy, number) unsigned int ux, uy; int number; { - double p; /* all pointtypes fit in a (x +/-p)x(y +/-p) box */ + double p; /* all pointtypes fit in a (x +/-p)x(y +/-p) box */ double x, y; @@ -639,8 +679,9 @@ int number; number = number % 63; switch (number) { case -1: -/* HBB: corrected format string, shuts up gcc -Wall */ - fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,1,1,%u,0,0,0,0,8,3,0,[\n]).\n", + /* HBB: corrected format string, shuts up gcc -Wall */ + fprintf(gpoutfile, "\ +poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,1,1,%u,0,0,0,0,8,3,0,[\n]).\n", sActColor, x, y, x + 1, y + 1, uActNr++); break; case 0: @@ -672,14 +713,18 @@ poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0 case 2: /* star */ /* taking thickness 2 for cross & plus & star */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\n", sActColor, x, y - p - 1, x, y + p + 1, uActNr++); - fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n", + fprintf(gpoutfile, "\ +poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n", sActColor, x - p - 1, y, x + p + 1, y, uActNr++); - fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n", + fprintf(gpoutfile, "\ +poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n", + fprintf(gpoutfile, "\ +poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n", sActColor, x - p, y + p, x + p, y - p, uActNr++); uActNr += 4; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); @@ -687,233 +732,277 @@ poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0 /*}}} */ case 3: /* box */ - fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fprintf(gpoutfile, "\ +box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr); uActNr++; break; /*}}} */ case 4: /* filled box */ - fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n", + fprintf(gpoutfile, "\ +box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr); uActNr++; break; /*}}} */ case 5: /* circle */ - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr); uActNr++; break; /*}}} */ case 6: /* filled circle */ - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n", + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr); uActNr++; break; /*}}} */ case 7: /* triangle up */ - fprintf(gpoutfile, - "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, x, y - p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',4,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, + x, y - p, uActNr); uActNr++; break; /*}}} */ case 8: /* filled triangle up */ - fprintf(gpoutfile, - "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, x, y - p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',4,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, + x, y - p, uActNr); uActNr++; break; /*}}} */ case 9: /* triangle down */ - fprintf(gpoutfile, - "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, x, y + p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',4,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, + x, y + p, uActNr); uActNr++; break; /*}}} */ case 10: /* filled triangle down */ - fprintf(gpoutfile, - "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, x, y + p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',4,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, + x, y + p, uActNr); uActNr++; break; /*}}} */ case 11: /* diamond */ - fprintf(gpoutfile, - "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',5,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n\ +]).\n", + sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, + uActNr); uActNr++; break; /*}}} */ case 12: /* filled diamond */ - fprintf(gpoutfile, - "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',5,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n\ +]).\n", + sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, + uActNr); uActNr++; break; /*}}} */ case 13: /* pentagon */ - fprintf(gpoutfile, - "polygon('%s',6,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, x - 0.625 * p, y + p, - x - p, y - p / 4, x, y - p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',6,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, + x - 0.625 * p, y + p, x - p, y - p / 4, x, y - p, uActNr); uActNr++; break; /*}}} */ case 14: /* filled pentagon */ - fprintf(gpoutfile, - "polygon('%s',6,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", - sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, x - 0.625 * p, y + p, - x - p, y - p / 4, x, y - p, uActNr); + fprintf(gpoutfile, "\ +polygon('%s',6,[\n\ +%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", + sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, + x - 0.625 * p, y + p, x - p, y - p / 4, x, y - p, uActNr); uActNr++; break; /*}}} */ case 15: /* circle1 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n\ +]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,4480,2560,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x + p * 0.342, y - p * 0.94, x - p * 0.342, y - p * - 0.94, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,4480,2560,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x + p * 0.342, y - p * 0.94, + x - p * 0.342, y - p * 0.94, 2 * p, 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 16: /* circle2 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 17: /* circle3 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 18: /* circle4 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,11520,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x + p, y, x - p, y, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,11520,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x + p, y, x - p, y, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 19: /* circle5 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 20: /* circle6 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, 2 * p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, + 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, + 2 * p, uActNr++); uActNr += 3; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 21: /* circle7 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,11520,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y - p, x, y + p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,11520,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y - p, x, y + p, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 22: /* circle8 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,17280,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x + p, y, x, y + p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,17280,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x + p, y, x, y + p, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 23: /* circle9 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 24: /* circle10 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,11520,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y + p, x, y - p, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,11520,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y + p, x, y - p, 2 * p, + 2 * p, uActNr++); uActNr += 2; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; /*}}} */ case 25: /* circle11 */ - fprintf(gpoutfile, "group([\n"); - fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", + fputs("group([\n", gpoutfile); + fprintf(gpoutfile, "\ +oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n", sActColor, x - p, y - p, x + p, y + p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, 2 * p, uActNr++); - fprintf(gpoutfile, - "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n", - sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, + 2 * p, uActNr++); + fprintf(gpoutfile, "\ +arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n", + sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, + 2 * p, uActNr++); uActNr += 3; fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++); break; @@ -1385,7 +1474,8 @@ poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0 /*}}} */ /***************************************************************************/ -TERM_PUBLIC void TGIF_set_pointsize(size) +TERM_PUBLIC void +TGIF_set_pointsize(size) double size; { uActPointSize = size; @@ -1393,11 +1483,13 @@ double size; /*}}} */ /***************************************************************************/ -TERM_PUBLIC int TGIF_set_font(font) /* Entry font as added by DJL in post.trm */ +TERM_PUBLIC int +TGIF_set_font(font) /* Entry font as added by DJL in post.trm */ char *font; { char name[32]; - int size, sep; + int size; + size_t sep; sep = strcspn(font, ","); strncpy(name, font, sep); @@ -1408,6 +1500,64 @@ char *font; return TRUE; } +#ifdef PM3D +TERM_PUBLIC int TGIF_make_palette(t_sm_palette *palette) +{ + int i; + + /* Query to determine palette size */ + if (palette==NULL) { + return(TGIF_palette_size); /* How big is palette ? */ + } + + TGIF_flush_poly(); /* Clean up current data */ + + if (TGIF_palette_set == FALSE) { + /* Create new palette */ + for (i = 0; i < sm_palette.colors; i++) { + sprintf(TGIF_colours[i],"#%.2x%.2x%.2x", + (int)( palette->color[i].r * 255 + 0.5 ), + (int)( palette->color[i].g * 255 + 0.5 ), + (int)( palette->color[i].b * 255 + 0.5 ) ); + } + TGIF_palette_set = TRUE; + } else { + fprintf(stderr, "Attempt to set palette twice\n"); + } + return(0); +} + +TERM_PUBLIC void TGIF_set_color(double gray) +{ + if (TGIF_palette_set == FALSE) { + fprintf(stderr,"Palette used before set\n"); /* Error condition */ + } + sprintf(sActColor,"%s",TGIF_colours[(int)(gray*TGIF_palette_size)]); +} + +TERM_PUBLIC void TGIF_filled_polygon(int points, gpiPoint *corners) +{ + int i; + + if (TGIF_palette_set == FALSE) { + fprintf(stderr,"Palette used before set\n"); /* Error condition */ + } + + if (eTgifState == INPOLY) + TGIF_flush_poly(); /* Clean up current data */ + + fprintf(gpoutfile, "polygon('%s',%d,[\n",sActColor,points+1); +/* loop through points, do the first one last as well as first */ + fprintf(gpoutfile,"%u,%u",(corners[0].x+uXshift),(uYshift-corners[0].y)); + for (i=1;i