1 /* Hello, Emacs, this is -*-C-*- */
2 /* $Id: tgif.trm,v 1.41.2.2 2009/03/02 23:57:54 sfeam Exp $ */
4 /* GNUPLOT - tgif.trm */
7 * Copyright 1990 - 1993, 1998, 2004
9 * Permission to use, copy, and distribute this software and its
10 * documentation for any purpose with or without fee is hereby granted,
11 * provided that the above copyright notice appear in all copies and
12 * that both that copyright notice and this permission notice appear
13 * in supporting documentation.
15 * Permission to modify the software is granted, but not the right to
16 * distribute the complete modified source code. Modifications are to
17 * be distributed as patches to the released version. Permission to
18 * distribute binaries produced by compiling modified sources is granted,
20 * 1. distribute the corresponding source modifications from the
21 * released version in the form of a patch file along with the binaries,
22 * 2. add special version identification to distinguish your version
23 * in addition to the base release version number,
24 * 3. provide your name and address as the primary contact for the
25 * support of your modified version, and
26 * 4. retain our contact information in regard to use of the base
28 * Permission to distribute the released version of the source code along
29 * with corresponding source modifications in the form of a patch file is
30 * granted with same provisions 2 through 4 for binary distributions.
32 * This software is provided "as is" without express or implied warranty
33 * to the extent permitted by applicable law.
37 /* This file is included by ../term.c. */
39 /* This terminal driver supports: */
43 /* Werner Geppert and Andreas Kuhlewind */
44 /* March, 21st 1995 */
46 /* send your comments or suggestions to werner@mez.ruhr-uni-bochum.de */
49 /* MODIFIED May, 11st 1997 by NOVÁK Levente (novakl@tigris.klte.hu): */
51 /* - Modified the default linewidth for borders from 3 to 2 */
52 /* - Modified the default size of markers' bounding box */
53 /* to allow nicer shapes */
54 /* - Slightly modified the markers and added several new ones, */
55 /* now we have 64 different pointtypes, the same as for the */
56 /* PostScript terminal */
57 /* - I left the %.1f format for pixel positions, but I think */
58 /* Tgif does only calculate with integer positions */
60 /* Modified 07 July 2000 by Ian MacPhedran */
61 /* - added PM3D support */
63 /* Modified 04 February 2002 by Levente Novák */
64 /* - break long "polygon()" directives into lines, as it made */
65 /* Tgif fail polygons had >8 sides */
66 /* (e.g. when using "filledcurves") */
68 /* Modified 29 November 2004 Shigeharu TAKENO <shige@iee.niit.ac.jp> */
69 /* - add linewidth and monochrome options */
70 /* update option parsing to be order-independent */
72 /***************************************************************************/
75 /***************************************************************************/
86 TERM_PUBLIC void TGIF_options __PROTO((void));
87 TERM_PUBLIC void TGIF_init __PROTO((void));
88 TERM_PUBLIC void TGIF_reset __PROTO((void));
89 TERM_PUBLIC void TGIF_text __PROTO((void));
90 TERM_PUBLIC void TGIF_graphics __PROTO((void));
91 TERM_PUBLIC void TGIF_move __PROTO((unsigned int ux, unsigned int uy));
92 TERM_PUBLIC void TGIF_vector __PROTO((unsigned int ux, unsigned int uy));
93 TERM_PUBLIC void TGIF_linetype __PROTO((int linetype));
94 TERM_PUBLIC void TGIF_put_text __PROTO((unsigned int ux, unsigned int uy, const char *str)); /* ref point and text */
95 TERM_PUBLIC int TGIF_text_angle __PROTO((int ang));
96 TERM_PUBLIC int TGIF_justify_text __PROTO((enum JUSTIFY mode));
97 TERM_PUBLIC void TGIF_point __PROTO((unsigned int ux, unsigned int uy, int number));
98 TERM_PUBLIC void TGIF_arrow __PROTO((unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head));
99 TERM_PUBLIC int TGIF_set_font __PROTO((const char *font));
100 TERM_PUBLIC void TGIF_set_pointsize __PROTO((double size));
102 TERM_PUBLIC void TGIF_set_linewidth __PROTO((double size));
104 TERM_PUBLIC int TGIF_make_palette (t_sm_palette *);
105 /* TERM_PUBLIC void TGIF_previous_palette (void); */
106 TERM_PUBLIC void TGIF_set_color (t_colorspec *);
107 TERM_PUBLIC void TGIF_filled_polygon (int, gpiPoint *);
109 /* default length for static strings */
110 #define TGIF_STRLEN_MAX 255
112 /* standard x/y plot size in portrait mode */
113 #define TGIF_XMAX 950
114 #define TGIF_YMAX 634
116 /* total available plotting area */
117 #define TGIF_XTOT 950
118 #define TGIF_YTOT 1400
124 #define TGIF_XSHIFT 1030 /* 80 points skip */
125 #define TGIF_YSHIFT 714
127 #define TGIF_VCHAR 18 /* default is 18 pt */
128 #define TGIF_HCHAR (18*6/10)
130 #define TGIF_VTIC (TGIF_YMAX/80)
131 #define TGIF_HTIC (TGIF_YMAX/80)
133 static int TGIF_palette_set = FALSE; /* PM3D Palette Set ? */
134 static int TGIF_palette_size = 128; /* Number of colours in palette */
137 static int TGIF_palette_offst = 32; /* Offset from zero for user colours */
139 static char TGIF_colours[128][8]; /* Colours */
142 #define TGIF_MAXPOLY 100
144 #define GOT_TGIF_PROTO
147 #ifndef TERM_PROTO_ONLY
150 /* tgif driver by Werner Geppert, werner@mez.ruhr-uni-bochum.de */
151 /***************************************************************************/
153 static unsigned int uLastTgifX, uLastTgifY; /* last Coordinate */
155 static unsigned int uActNr; /* current elementnumber */
156 static unsigned int uActPage; /* current pagenumber */
157 static unsigned int uActResolution=100; /* resolution in percent */
158 static unsigned int uActZoom; /* zoom factor */
159 static unsigned int uActAngle; /* current textangle */
160 static unsigned int uActThick; /* actual linethickness */
161 static unsigned int uActPointSize; /* point size */
162 static unsigned int uActStyle; /* actual linestyle */
163 static unsigned int uActJust; /* actual textjustification */
164 static unsigned int uXshift; /* actual shift x */
165 static unsigned int uYshift; /* actual shift y */
166 static unsigned int uTgifPlotCount; /* counts number of plots */
167 static unsigned int uTgifPlotRow=1, uTgifPlotCol=1; /* actual plot row and col */
168 static unsigned int uTgif_win_horiz=1, /* number of plots in x and */
169 uTgif_win_verti=1; /* y direction [x,y] */
173 static double uActThick_factor=1.0;
174 static double uActThick_default=1.0;
177 static TBOOLEAN TgifUseColor = TRUE;
180 static char sActColor[TGIF_STRLEN_MAX]; /* current color */
181 static unsigned int uDefaultFontSize = 18; /* default font size */
182 static unsigned int uActFontSize = 18; /* current font size */
183 static char sDefaultFont[TGIF_STRLEN_MAX] = "Helvetica"; /* default font */
184 static char sActFont[TGIF_STRLEN_MAX] = "Helvetica"; /* current font */
185 /* static char sActPointString[TGIF_STRLEN_MAX]; HBB: unused */
187 static TBOOLEAN TgifSolid = FALSE;
188 static TBOOLEAN TgifPortrait = TRUE;
190 static unsigned int uTgifPlotsPerPage = 1;
193 * 10 different pointtypes need 10 different linetypes
196 /* NL: Modified first value to 2 from 3 */
197 static unsigned int uLineThick[] = { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
198 static unsigned int uLineStyle[] = { 0, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0 };
199 static const char *psColors[] = {
200 "black", "black", /* border and x/y-zero-axes */
201 "red", "green", "blue", "magenta", "cyan", "yellow",
202 "DarkSeaGreen", "HotPink", "black", "coral"
205 #if 0 /* HBB: unused */
206 static const char *psFonts[] = {
207 "Times-Roman", "Courier", "Helvetica", "NewCenturySchlbk-Roman",
211 static unsigned int psFontSizes[] = {
212 8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34, 40, 45, 50
216 static int iTgifPolyCount;
217 static unsigned int uBuffX[TGIF_MAXPOLY], uBuffY[TGIF_MAXPOLY];
220 NEWPOLY = 100, INPOLY
222 static enum eState eTgifState = NEWPOLY;
224 static void TGIF_flush_poly __PROTO((void));
229 /***************************************************************************/
236 if (eTgifState == INPOLY) {
237 fprintf(gpoutfile, "poly('%s',%d,[\n\t", sActColor, iTgifPolyCount);
239 for (i = 0; i < iTgifPolyCount - 1; i++) {
240 fprintf(gpoutfile, "%u,%u,", uBuffX[i], uBuffY[i]);
241 if ((i + 1) % 8 == 0)
242 fputs("\n\t", gpoutfile);
245 fprintf(gpoutfile, "%u,%u],0,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
246 uBuffX[iTgifPolyCount - 1], uBuffY[iTgifPolyCount - 1],
247 uActThick, uActNr, uActStyle);
251 eTgifState = NEWPOLY;
253 if (gpoutfile != (FILE *) NULL)
256 } /* TGIF_flush_poly */
258 /***************************************************************************/
261 TGIF_MONOCHROME, TGIF_COLOR,
263 TGIF_PORTRAIT, TGIF_LANDSCAPE,
265 TGIF_SOLID, TGIF_DASHED,
271 static struct gen_table TGIF_opts[] =
273 {"mo$nochrome", TGIF_MONOCHROME},
274 {"c$olor", TGIF_COLOR},
275 {"c$olour", TGIF_COLOR},
276 {"linew$idth", TGIF_LINEWIDTH},
277 {"lw", TGIF_LINEWIDTH},
278 {"p$ortrait", TGIF_PORTRAIT},
279 {"l$andscape", TGIF_LANDSCAPE},
281 {"s$olid", TGIF_SOLID},
282 {"d$ashed", TGIF_DASHED},
284 {"default", TGIF_DEFAULT},
293 double dscaleH, dscaleV;
296 while (!END_OF_COMMAND) {
297 option = lookup_table(&TGIF_opts[0],c_token);
300 strcpy(sActFont, "Helvetica");
301 strcpy(sDefaultFont, "Helvetica");
303 uDefaultFontSize = 18;
304 term->v_char = (unsigned int) (uActFontSize);
305 term->h_char = (unsigned int) (uActFontSize * 6 / 10);
312 uTgifPlotsPerPage = 1;
317 uActResolution = 100;
319 uActThick_factor = 1.0;
320 uActThick_default = 1.0;
325 case TGIF_MONOCHROME:
326 TgifUseColor = FALSE;
337 if (END_OF_COMMAND) {
338 int_error(c_token, "linewidth: width is not specified.");
340 if((uActThick_default = real(const_express(&a)))<=0.0){
341 int_error(c_token-1,"linewidth: out of range");
342 uActThick_default = 1.0;
352 TgifPortrait = FALSE;
353 /* uActResolution = 140;
359 if (END_OF_COMMAND) {
360 int_error(c_token, "no. windows: [horizontal,vertical] expected");
361 } else if (!equals(c_token, ",")) {
362 uTgif_win_horiz = (int) real(const_express(&a));
364 if (!equals(c_token, ","))
365 int_error(c_token, "',' expected");
367 if (!equals(c_token, "]")) {
368 uTgif_win_verti = (int) real(const_express(&a));
370 if (!equals(c_token, "]"))
371 int_error(c_token, "expecting ']'");
373 uTgifPlotsPerPage = uTgif_win_verti * uTgif_win_horiz;
390 if ((s = try_to_get_string())) {
392 char *comma = strrchr(s,',');
393 if (comma && (1 == sscanf(comma+1,"%lf",&fontsize))) {
395 uActFontSize = (int)(fontsize+0.5);
397 strncpy(sActFont, s, sizeof(sActFont));
398 strcpy(sDefaultFont, sActFont);
400 } else if (option == TGIF_FONT) {
401 int_error(c_token,"Expecting font name ");
403 /* We have font size specified */
404 uActFontSize = (unsigned int) real(const_express(&b));
405 uDefaultFontSize = uActFontSize;
406 term->v_char = (unsigned int) (uActFontSize);
407 term->h_char = (unsigned int) (uActFontSize * 6 / 10);
414 dscaleH = (double) 100.0 *(TGIF_XTOT) / (xsize * (TGIF_XMAX + (uTgif_win_horiz - 1) * TGIF_XSHIFT));
415 dscaleV = (double) 100.0 *(TGIF_YTOT) / (ysize * (TGIF_YMAX + (uTgif_win_verti - 1) * TGIF_YSHIFT));
416 uActResolution = (int) GPMIN(dscaleH, dscaleV);
417 switch (uTgif_win_verti) {
431 dscaleH = (double) 100.0 *(TGIF_YTOT) / (xsize * (TGIF_XMAX + (uTgif_win_horiz - 1) * TGIF_XSHIFT));
432 dscaleV = (double) 100.0 *(TGIF_XTOT) / (ysize * (TGIF_YMAX + (uTgif_win_verti - 1) * TGIF_YSHIFT));
433 uActResolution = (unsigned int) GPMIN(dscaleH, dscaleV);
435 switch (uTgif_win_verti) {
450 sprintf(&(term_options[strlen(term_options)]), "%s [%u,%u]",
451 TgifPortrait ? "portrait" : "landscape",
452 uTgif_win_horiz, uTgif_win_verti);
455 strcat(term_options, TgifUseColor ? " color" : " monochrome");
458 sprintf(&(term_options[strlen(term_options)]), " linewidth %f", uActThick_default);
460 sprintf(&(term_options[strlen(term_options)]), " %s \"%s\" %u",
461 TgifSolid ? "solid" : "dashed",
462 sActFont, uActFontSize);
465 /***************************************************************************/
471 /* uActResolution= TgifPortrait ? (unsigned int)100 : (unsigned int)145 ; */
472 uActResolution = (unsigned int) 100;
474 if (uTgifPlotsPerPage > 1) {
475 fputs("warning: using standard multiplot\n", stderr);
476 uTgifPlotsPerPage = 1;
480 fprintf(gpoutfile, "\
482 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\
484 %% @(#)Creator: gnuplot %s patchlevel %s\n\
488 TgifPortrait ? 0 : 1, uActResolution, uActZoom, sActFont, uActFontSize,
489 gnuplot_version, gnuplot_patchlevel);
490 eTgifState = NEWPOLY;
494 TGIF_palette_set = FALSE; /* PM3D Palette Set ? */
498 /***************************************************************************/
507 term->xmax = (TgifPortrait) ? TGIF_XTOT : TGIF_YTOT;
508 term->ymax = (TgifPortrait) ? TGIF_YTOT : TGIF_XTOT;
509 uLastTgifX = (TgifPortrait) ? TGIF_XOFF : TGIF_YOFF;
510 uLastTgifY = (TgifPortrait) ? TGIF_YTOT + TGIF_YOFF : TGIF_XTOT + TGIF_XOFF;
512 uYshift = uLastTgifY;
513 uXshift = uLastTgifX;
516 if (uTgifPlotCount < uTgifPlotsPerPage)
519 fputs("error: number of plots > plots per page\n", stderr);
523 uXshift = (unsigned int) TGIF_XOFF *100 / uActResolution + (xsize * (uTgifPlotCol - 1) * TGIF_XSHIFT);
524 uYshift = (unsigned int) TGIF_YOFF *100 / uActResolution + (ysize * (TGIF_YMAX +
525 (uTgifPlotRow - 1) * TGIF_YSHIFT));
527 if (uTgifPlotCount % uTgif_win_horiz == 0) {
534 uLastTgifX = uXshift;
535 uLastTgifY = uYshift;
543 /* default settings for each plot */
550 #ifndef USE_MONO_MODE
551 strcpy(sActColor, psColors[0]);
553 if(TgifUseColor == FALSE) strcpy(sActColor,"black");
554 else strcpy(sActColor, psColors[0]);
557 } /* TGIF_graphics */
559 /***************************************************************************/
569 /***************************************************************************/
580 if (gpoutfile != (FILE *) NULL)
585 /***************************************************************************/
587 TGIF_linetype(int linetype)
596 ult = 2 + linetype % 10;
597 else if (linetype < -2)
602 #ifndef USE_MONO_MODE
603 strcpy(sActColor, psColors[ult]);
605 if(TgifUseColor == FALSE) strcpy(sActColor,"black");
606 else strcpy(sActColor, psColors[ult]);
608 #ifndef USE_LINEWIDTH
609 uActThick = uLineThick[ult];
611 uActThick = uActThick_factor * uActThick_default * uLineThick[ult]+0.5;
614 uActStyle = uLineStyle[ult];
616 if (ult == 1) /* grid */
617 uActStyle = uLineStyle[ult];
619 uActStyle = uLineStyle[2];
623 } /* TGIF_linetype */
625 /***************************************************************************/
627 TGIF_move(unsigned int ux, unsigned int uy)
630 uLastTgifX = ux + uXshift;
631 uLastTgifY = uYshift - uy;
633 if (eTgifState == INPOLY)
640 /***************************************************************************/
642 TGIF_vector(unsigned int ux, unsigned int uy)
650 if (eTgifState == NEWPOLY) {
651 uBuffX[0] = uLastTgifX;
652 uBuffY[0] = uLastTgifY;
656 uBuffX[iTgifPolyCount] = ux;
657 uBuffY[iTgifPolyCount] = uy;
663 if (iTgifPolyCount == TGIF_MAXPOLY) {
669 /***************************************************************************/
672 unsigned int sx, unsigned int sy,
673 unsigned int ex, unsigned int ey,
686 fprintf(gpoutfile, "\
688 \t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
689 sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle);
691 fprintf(gpoutfile, "\
693 \t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
694 sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle);
706 /***************************************************************************/
708 TGIF_put_text(unsigned int ux, unsigned int uy, const char *str)
712 struct termentry *t = term;
717 y = uYshift - uy - t->v_char / 2;
719 if (strlen(str) == 0)
722 fprintf(gpoutfile, "\
723 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",
724 sActColor, x, y, sActFont, uActFontSize,
725 (uActAngle ? CENTRE : uActJust), uActAngle,
731 /* reset font size and font, they might have been changed */
732 uActFontSize = uDefaultFontSize;
733 strcpy(sActFont, sDefaultFont);
736 } /* TGIF_put_text */
738 /***************************************************************************/
740 TGIF_text_angle(int ang)
743 case 90: uActAngle = 3; break;
745 case -180: uActAngle = 2; break;
747 case 270: uActAngle = 1; break;
748 default: uActAngle = 0; break;
751 } /* TGIF_text_angle */
754 /***************************************************************************/
756 TGIF_justify_text(enum JUSTIFY mode)
760 } /* TGIF_justify_text */
763 /***************************************************************************/
765 TGIF_point(unsigned int ux, unsigned int uy, int number)
767 double p; /* all pointtypes fit in a (x +/-p)x(y +/-p) box */
773 x = (double) (ux + uXshift);
774 y = (double) (uYshift - uy);
776 p = pointsize * 8.0; /* NL: Increased the bounding box (p value) from 4.0 to 8.0 */
777 if (p == (double) 0.0)
783 number = number % 63;
786 /* HBB: corrected format string, shuts up gcc -Wall */
787 fprintf(gpoutfile, "\
788 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,1,1,%u,0,0,0,0,8,3,0,[\n]).\n",
789 sActColor, x, y, x + 1, y + 1, uActNr++);
793 /* taking thickness 2 for cross & plus & star */
794 fprintf(gpoutfile, "\
796 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n\
797 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",
798 sActColor, x - p, y - p, x + p, y + p, uActNr+1,
799 sActColor, x - p, y + p, x + p, y - p, uActNr+2);
801 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
806 /* taking thickness 2 for cross & plus & star */
807 fprintf(gpoutfile, "\
809 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\n\
810 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n",
811 sActColor, x, y - p - 1, x, y + p + 1, uActNr+1,
812 sActColor, x - p - 1, y, x + p + 1, y, uActNr+2);
814 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
819 /* taking thickness 2 for cross & plus & star */
820 fputs("group([\n", gpoutfile);
821 fprintf(gpoutfile, "\
822 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\n",
823 sActColor, x, y - p - 1, x, y + p + 1, uActNr++);
824 fprintf(gpoutfile, "\
825 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n",
826 sActColor, x - p - 1, y, x + p + 1, y, uActNr++);
827 fprintf(gpoutfile, "\
828 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",
829 sActColor, x - p, y - p, x + p, y + p, uActNr++);
830 fprintf(gpoutfile, "\
831 poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",
832 sActColor, x - p, y + p, x + p, y - p, uActNr++);
834 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
839 fprintf(gpoutfile, "\
840 box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
841 sActColor, x - p, y - p, x + p, y + p, uActNr);
847 fprintf(gpoutfile, "\
848 box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
849 sActColor, x - p, y - p, x + p, y + p, uActNr);
855 fprintf(gpoutfile, "\
856 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
857 sActColor, x - p, y - p, x + p, y + p, uActNr);
863 fprintf(gpoutfile, "\
864 oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
865 sActColor, x - p, y - p, x + p, y + p, uActNr);
871 fprintf(gpoutfile, "\
873 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
874 sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p,
880 /* filled triangle up */
881 fprintf(gpoutfile, "\
883 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
884 sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p,
891 fprintf(gpoutfile, "\
893 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
894 sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p,
900 /* filled triangle down */
901 fprintf(gpoutfile, "\
903 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
904 sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p,
911 fprintf(gpoutfile, "\
913 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n\
915 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p,
922 fprintf(gpoutfile, "\
924 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n\
926 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p,
933 fprintf(gpoutfile, "\
935 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
936 sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p,
937 x - 0.625 * p, y + p, x - p, y - p / 4, x, y - p, uActNr);
942 /* filled pentagon */
943 fprintf(gpoutfile, "\
945 %.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
946 sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p,
947 x - 0.625 * p, y + p, x - p, y - p / 4, x, y - p, uActNr);
953 fputs("group([\n", gpoutfile);
954 fprintf(gpoutfile, "\
955 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n\
957 sActColor, x - p, y - p, x + p, y + p, uActNr++);
958 fprintf(gpoutfile, "\
959 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",
960 sActColor, x - p, y - p, x, y, x + p * 0.342, y - p * 0.94,
961 x - p * 0.342, y - p * 0.94, 2 * p, 2 * p, uActNr++);
963 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
968 fputs("group([\n", gpoutfile);
969 fprintf(gpoutfile, "\
970 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
971 sActColor, x - p, y - p, x + p, y + p, uActNr++);
972 fprintf(gpoutfile, "\
973 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",
974 sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p,
977 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
982 fputs("group([\n", gpoutfile);
983 fprintf(gpoutfile, "\
984 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
985 sActColor, x - p, y - p, x + p, y + p, uActNr++);
986 fprintf(gpoutfile, "\
987 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",
988 sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p,
991 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
996 fputs("group([\n", gpoutfile);
997 fprintf(gpoutfile, "\
998 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
999 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1000 fprintf(gpoutfile, "\
1001 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",
1002 sActColor, x - p, y - p, x, y, x + p, y, x - p, y, 2 * p,
1005 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1010 fputs("group([\n", gpoutfile);
1011 fprintf(gpoutfile, "\
1012 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1013 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1014 fprintf(gpoutfile, "\
1015 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",
1016 sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p,
1019 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1024 fputs("group([\n", gpoutfile);
1025 fprintf(gpoutfile, "\
1026 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1027 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1028 fprintf(gpoutfile, "\
1029 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",
1030 sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p,
1032 fprintf(gpoutfile, "\
1033 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",
1034 sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p,
1037 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1042 fputs("group([\n", gpoutfile);
1043 fprintf(gpoutfile, "\
1044 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1045 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1046 fprintf(gpoutfile, "\
1047 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",
1048 sActColor, x - p, y - p, x, y, x, y - p, x, y + p, 2 * p,
1051 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1056 fputs("group([\n", gpoutfile);
1057 fprintf(gpoutfile, "\
1058 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1059 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1060 fprintf(gpoutfile, "\
1061 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",
1062 sActColor, x - p, y - p, x, y, x + p, y, x, y + p, 2 * p,
1065 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1070 fputs("group([\n", gpoutfile);
1071 fprintf(gpoutfile, "\
1072 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1073 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1074 fprintf(gpoutfile, "\
1075 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",
1076 sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p,
1079 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1084 fputs("group([\n", gpoutfile);
1085 fprintf(gpoutfile, "\
1086 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1087 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1088 fprintf(gpoutfile, "\
1089 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",
1090 sActColor, x - p, y - p, x, y, x, y + p, x, y - p, 2 * p,
1093 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1098 fputs("group([\n", gpoutfile);
1099 fprintf(gpoutfile, "\
1100 oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1101 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1102 fprintf(gpoutfile, "\
1103 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",
1104 sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p,
1106 fprintf(gpoutfile, "\
1107 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",
1108 sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p,
1111 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1116 fprintf(gpoutfile, "group([\n");
1117 fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1118 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1120 "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,17280,%u,0,0,8,3,0,[\n]).\n",
1121 sActColor, x - p, y - p, x, y, x, y + p, x - p, y, 2 * p, 2 * p, uActNr++);
1123 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1128 fprintf(gpoutfile, "group([\n");
1129 fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1130 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1132 "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,11520,%u,0,0,8,3,0,[\n]).\n",
1133 sActColor, x - p, y - p, x, y, x - p, y, x + p, y, 2 * p, 2 * p, uActNr++);
1135 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1140 fprintf(gpoutfile, "group([\n");
1141 fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1142 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1144 "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,17280,%u,0,0,8,3,0,[\n]).\n",
1145 sActColor, x - p, y - p, x, y, x - p, y, x, y - p, 2 * p, 2 * p, uActNr++);
1147 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1152 fprintf(gpoutfile, "group([\n");
1153 fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1154 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1156 "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,17280,%u,0,0,8,3,0,[\n]).\n",
1157 sActColor, x - p, y - p, x, y, x, y - p, x + p, y, 2 * p, 2 * p, uActNr++);
1159 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1164 fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1165 sActColor, x - p, y - p, x + p, y + p, uActNr);
1171 fprintf(gpoutfile, "group([\n");
1172 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1173 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1174 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1175 sActColor, x - p / 4, y - p, x + p / 4, y, uActNr++);
1177 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1182 fprintf(gpoutfile, "group([\n");
1183 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1184 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1185 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1186 sActColor, x, y - p, x + p, y, uActNr++);
1188 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1193 fprintf(gpoutfile, "group([\n");
1194 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1195 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1196 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1197 sActColor, x - p, y - p, x, y, uActNr++);
1199 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1204 fprintf(gpoutfile, "group([\n");
1205 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1206 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1207 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1208 sActColor, x - p, y - p, x + p, y, uActNr++);
1210 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1215 fprintf(gpoutfile, "group([\n");
1216 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1217 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1218 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1219 sActColor, x - p, y, x, y + p, uActNr++);
1221 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1226 fprintf(gpoutfile, "group([\n");
1227 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1228 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1229 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1230 sActColor, x, y - p, x + p, y, uActNr++);
1231 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1232 sActColor, x - p, y, x, y + p, uActNr++);
1234 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1239 fprintf(gpoutfile, "group([\n");
1240 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1241 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1242 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1243 sActColor, x - p, y - p, x, y + p, uActNr++);
1245 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1250 fprintf(gpoutfile, "group([\n");
1251 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1252 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1253 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1254 sActColor, x - p, y - p, x + p, y, uActNr++);
1255 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1256 sActColor, x - p, y, x, y + p, uActNr++);
1258 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1263 fprintf(gpoutfile, "group([\n");
1264 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1265 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1266 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1267 sActColor, x, y, x + p, y + p, uActNr++);
1269 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1274 fprintf(gpoutfile, "group([\n");
1275 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1276 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1277 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1278 sActColor, x, y - p, x + p, y + p, uActNr++);
1280 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1285 fprintf(gpoutfile, "group([\n");
1286 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1287 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1288 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1289 sActColor, x - p, y - p, x, y, uActNr++);
1290 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1291 sActColor, x, y, x + p, y + p, uActNr++);
1293 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1298 fprintf(gpoutfile, "group([\n");
1299 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1300 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1301 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1302 sActColor, x - p, y - p, x + p, y, uActNr++);
1303 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1304 sActColor, x, y, x + p, y + p, uActNr++);
1306 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1311 fprintf(gpoutfile, "group([\n");
1312 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1313 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1314 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1315 sActColor, x - p, y, x + p, y + p, uActNr++);
1317 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1322 fprintf(gpoutfile, "group([\n");
1323 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1324 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1325 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1326 sActColor, x, y - p, x + p, y, uActNr++);
1327 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1328 sActColor, x - p, y, x + p, y + p, uActNr++);
1330 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1335 fprintf(gpoutfile, "group([\n");
1336 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
1337 sActColor, x - p, y - p, x + p, y + p, uActNr++);
1338 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1339 sActColor, x - p, y - p, x, y, uActNr++);
1340 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1341 sActColor, x - p, y, x + p, y + p, uActNr++);
1343 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1348 fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
1349 sActColor, x - p, y - p, x + p, y + p, uActNr);
1355 fprintf(gpoutfile, "group([\n");
1357 "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",
1358 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1360 "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",
1361 sActColor, x - 0.625 * p, y - 0.375 * p, x - 0.375 * p, y - 0.625 * p, x + p / 8,
1362 y - p / 8, x - p / 8, y + p / 8, x - 0.625 * p, y - 0.375 * p, uActNr);
1363 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1369 fprintf(gpoutfile, "group([\n");
1371 "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",
1372 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1374 "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",
1375 sActColor, x - p / 2, y - p / 2, x, y - p, x + p / 2, y - p / 2, x, y, x - p / 2,
1378 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1383 fprintf(gpoutfile, "group([\n");
1385 "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",
1386 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1388 "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",
1389 sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x - p / 2, y + p / 2, x - p, y, uActNr);
1391 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1396 fprintf(gpoutfile, "group([\n");
1398 "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",
1399 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1401 "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",
1402 sActColor, x - p, y, x, y - p, x + p / 2, y - p / 2, x - p / 2, y + p / 2, x - p,
1405 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1410 fprintf(gpoutfile, "group([\n");
1412 "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",
1413 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1415 "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",
1416 sActColor, x - p / 2, y + p / 2, x, y, x + p / 2, y + p / 2, x, y + p, x - p / 2,
1419 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1424 fprintf(gpoutfile, "group([\n");
1426 "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",
1427 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1429 "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",
1430 sActColor, x - p / 2, y - p / 2, x, y - p, x + p / 2, y - p / 2, x, y, x - p / 2,
1433 "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",
1434 sActColor, x - p / 2, y + p / 2, x, y, x + p / 2, y + p / 2, x, y + p, x - p / 2,
1437 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1442 fprintf(gpoutfile, "group([\n");
1444 "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",
1445 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1447 "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",
1448 sActColor, x - p, y, x - p / 2, y - p / 2, x + p / 2, y + p / 2, x, y + p, x - p,
1451 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1456 fprintf(gpoutfile, "group([\n");
1458 "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",
1459 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1461 "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
1462 sActColor, x - p, y, x, y - p, x + p / 2, y - p / 2, x, y, x + p / 2, y + p / 2,
1463 x, y + p, x - p, y, uActNr);
1465 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1470 fprintf(gpoutfile, "group([\n");
1472 "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",
1473 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1475 "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",
1476 sActColor, x, y, x + p / 2, y - p / 2, x + p, y, x + p / 2, y + p / 2, x, y, uActNr);
1478 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1483 fprintf(gpoutfile, "group([\n");
1485 "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",
1486 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1488 "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",
1489 sActColor, x - p / 2, y - p / 2, x, y - p, x + p, y, x + p / 2, y + p / 2, x - p /
1490 2, y - p / 2, uActNr);
1492 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1497 fprintf(gpoutfile, "group([\n");
1499 "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",
1500 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1502 "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",
1503 sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x - p / 2, y + p / 2, x - p, y, uActNr);
1505 "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",
1506 sActColor, x, y, x + p / 2, y - p / 2, x + p, y, x + p / 2, y + p / 2, x, y, uActNr);
1508 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1513 fprintf(gpoutfile, "group([\n");
1515 "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",
1516 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1518 "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
1519 sActColor, x - p, y, x, y - p, x + p, y, x + p / 2, y + p / 2, x, y, x - p / 2, y
1520 + p / 2, x - p, y, uActNr);
1522 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1527 fprintf(gpoutfile, "group([\n");
1529 "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",
1530 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1532 "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",
1533 sActColor, x - p / 2, y + p / 2, x + p / 2, y - p / 2, x + p, y, x, y + p, x - p /
1534 2, y + p / 2, uActNr);
1536 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1541 fprintf(gpoutfile, "group([\n");
1543 "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",
1544 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1546 "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
1547 sActColor, x - p / 2, y - p / 2, x, y - p, x + p, y, x, y + p, x - p / 2, y + p /
1548 2, x, y, x - p / 2, y - p / 2, uActNr);
1550 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1555 fprintf(gpoutfile, "group([\n");
1557 "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",
1558 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1560 "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
1561 sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x + p / 2, y - p / 2, x + p, y,
1562 x, y + p, x - p, y, uActNr);
1564 fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
1570 "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",
1571 sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
1580 /***************************************************************************/
1582 TGIF_set_pointsize(double size)
1584 uActPointSize = size < 0. ? 1. : size;
1587 #ifdef USE_LINEWIDTH
1589 TGIF_set_linewidth(double size)
1591 uActThick_factor = size < 0. ? 1. : size;
1596 /***************************************************************************/
1598 TGIF_set_font(const char *font)
1602 if (!font || !(*font))
1603 font = sDefaultFont;
1604 sep = strcspn(font, ",");
1606 strncpy(sActFont, font, sep);
1607 sActFont[sep] = NUL;
1609 sscanf(&(font[sep + 1]), "%d", &uActFontSize);
1614 TGIF_make_palette(t_sm_palette *palette)
1618 /* Query to determine palette size */
1619 if (palette==NULL) {
1620 return(TGIF_palette_size); /* How big is palette ? */
1623 TGIF_flush_poly(); /* Clean up current data */
1625 if (TGIF_palette_set == FALSE) {
1626 #ifdef USE_MONO_MODE
1627 if (TgifUseColor == FALSE
1628 || sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY) {
1630 if (TgifUseColor == FALSE
1631 && sm_palette.colorMode == SMPAL_COLOR_MODE_RGB){
1632 fprintf(stderr, "Monochrome Tgif file: ");
1633 fprintf(stderr, "using gray palette instead of color\n");
1635 for (i = 0; i < sm_palette.colors; i++) {
1636 int j = (int)(i * 255.0 / (sm_palette.colors-1) + 0.5);
1637 sprintf(TGIF_colours[i],"#%.2x%.2x%.2x",j,j,j);
1641 /* Create new palette */
1642 for (i = 0; i < sm_palette.colors; i++) {
1643 sprintf(TGIF_colours[i],"#%.2x%.2x%.2x",
1644 (int)( palette->color[i].r * 255 + 0.5 ),
1645 (int)( palette->color[i].g * 255 + 0.5 ),
1646 (int)( palette->color[i].b * 255 + 0.5 ) );
1648 #ifdef USE_MONO_MODE
1651 TGIF_palette_set = TRUE;
1653 fprintf(stderr, "Attempt to set palette twice\n");
1659 TGIF_set_color(t_colorspec *colorspec)
1661 double gray = colorspec->value;
1664 if (colorspec->type != TC_FRAC)
1667 color = (gray <= 0) ? 0 : (int)(gray * TGIF_palette_size);
1668 if (color >= TGIF_palette_size)
1669 color = TGIF_palette_size - 1;
1670 if (TGIF_palette_set == FALSE) {
1671 fprintf(stderr, "tgif: Palette used before set\n"); /* Error condition */
1673 sprintf(sActColor, "%s", TGIF_colours[color]);
1677 TGIF_filled_polygon(int points, gpiPoint *corners)
1681 if (eTgifState == INPOLY)
1682 TGIF_flush_poly(); /* Clean up current data */
1684 fprintf(gpoutfile, "polygon('%s',%d,[\n\t",sActColor,points+1);
1685 /* loop through points, do the first one last as well as first */
1686 fprintf(gpoutfile,"%u,%u,", corners[0].x+uXshift, uYshift-corners[0].y);
1687 for (i = 1; i < points; i++) {
1688 fprintf(gpoutfile, "%u,%u,",
1689 corners[i].x+uXshift, uYshift-corners[i].y);
1690 /* LN: Break long lines as Tgif is rather picky about them */
1691 if ((i + 1) % 8 == 0)
1692 fputs("\n\t", gpoutfile);
1694 fprintf(gpoutfile, "%u,%u", corners[0].x+uXshift, uYshift-corners[0].y);
1695 fprintf(gpoutfile, "],1,1,1,0,%u,0,0,0,0,0,[\n]).\n", uActNr);
1700 /***************************************************************************/
1702 #endif /* TERM_BODY */
1706 TERM_TABLE_START(tgif_driver)
1708 "TGIF X11 [mode] [x,y] [dashed] [\042font\042 [fontsize]]",
1709 TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR, TGIF_HCHAR,
1710 TGIF_VTIC, TGIF_HTIC, TGIF_options, TGIF_init, TGIF_reset,
1711 TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector,
1712 TGIF_linetype, TGIF_put_text, TGIF_text_angle,
1713 TGIF_justify_text, TGIF_point, TGIF_arrow, TGIF_set_font,
1714 #ifndef USE_LINEWIDTH
1715 TGIF_set_pointsize, TERM_CAN_MULTIPLOT, 0, 0, 0, 0
1717 TGIF_set_pointsize, TERM_CAN_MULTIPLOT, 0, 0, 0, TGIF_set_linewidth
1720 ,0, 0, 0, 0, 0 /* no mouse support for the tgif terminal */
1722 , TGIF_make_palette, 0 /*previous_palette*/, TGIF_set_color, TGIF_filled_polygon
1723 TERM_TABLE_END(tgif_driver)
1726 #define LAST_TERM tgif_driver
1728 #endif /* TERM_TABLE */
1730 #endif /* TERM_PROTO_ONLY */
1735 "?commands set terminal tgif",
1736 "?set terminal tgif",
1741 " Tgif is an X11-based drawing tool---it has nothing to do with GIF.",
1743 " The `tgif` driver supports different pointsizes (with `set pointsize`),",
1744 " different label fonts and font sizes (e.g. `set label \"Hallo\" at x,y font",
1745 " \"Helvetica,34\"`) and multiple graphs on the page. The proportions of the",
1746 " axes are not changed.",
1749 " set terminal tgif {portrait | landscape | default} {<[x,y]>}",
1750 " {monochrome | color}",
1751 " {{linewidth | lw} <LW>}",
1752 " {solid | dashed}",
1753 " {font \"<fontname>\"} {<fontsize>}",
1755 " where <[x,y]> specifies the number of graphs in the x and y directions on the",
1756 " page, `color` enables color, `linewidth` scales all linewidths by <LW>,",
1757 " \"<fontname>\" is the name of a valid PostScript font, and <fontsize>",
1758 " specifies the size of the PostScript font.",
1759 " `defaults` sets all options to their defaults: `portrait`, `[1,1]`, `color`,",
1760 " `linwidth 1.0`, `dashed`, `\"Helvetica\"`, and `18`.",
1762 " The `solid` option is usually prefered if lines are colored, as they often",
1763 " are in the editor. Hardcopy will be black-and-white, so `dashed` should be",
1764 " chosen for that.",
1766 " Multiplot is implemented in two different ways.",
1768 " The first multiplot implementation is the standard gnuplot multiplot feature:",
1770 " set terminal tgif",
1771 " set output \"file.obj\"",
1773 " set origin x01,y01",
1777 " set origin x02,y02",
1781 " See `set multiplot` for further information.",
1783 " The second version is the [x,y] option for the driver itself. The advantage",
1784 " of this implementation is that everything is scaled and placed automatically",
1785 " without the need for setting origins and sizes; the graphs keep their natural",
1786 " x/y proportions of 3/2 (or whatever is fixed by `set size`).",
1788 " If both multiplot methods are selected, the standard method is chosen and a",
1789 " warning message is given.",
1791 " Examples of single plots (or standard multiplot):",
1792 " set terminal tgif # defaults",
1793 " set terminal tgif \"Times-Roman\" 24",
1794 " set terminal tgif landscape",
1795 " set terminal tgif landscape solid",
1797 " Examples using the built-in multiplot mechanism:",
1798 " set terminal tgif portrait [2,4] # portrait; 2 plots in the x-",
1799 " # and 4 in the y-direction",
1800 " set terminal tgif [1,2] # portrait; 1 plot in the x-",
1801 " # and 2 in the y-direction",
1802 " set terminal tgif landscape [3,3] # landscape; 3 plots in both",