/* prototypes for this file are in hpgl.trm-proto */ /* GNUPLOT - hpgl.trm */ /* * Copyright (C) 1990 * * Permission to use, copy, and distribute this software and its * documentation for any purpose with or without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. * * Permission to modify the software is granted, but not the right to * distribute the modified code. Modifications are to be distributed * as patches to released version. * * This software is provided "as is" without express or implied warranty. * * This file is included by ../term.c. * * This terminal driver supports: * hpgl, hp7580b * * AUTHORS * Colin Kelley, Thomas Williams, Russell Lang * * send your comments or suggestions to (pixar!info-gnuplot@sun.com). * */ #define HPGL_XMAX 15200 #define HPGL_YMAX 10000 #define HPGL_XLAST (HPGL_XMAX - 1) #define HPGL_YLAST (HPGL_XMAX - 1) /* HPGL_VCHAR, HPGL_HCHAR are not used */ #define HPGL_VCHAR (HPGL_YMAX/100*32/10) /* 3.2% */ #define HPGL_HCHAR (HPGL_XMAX/100*12/10) /* 1.2% */ #define HPGL_VTIC (HPGL_YMAX/70) #define HPGL_HTIC (HPGL_YMAX/70) int HPGL_ang = 0; int HPGL_init(void) { return 0; } int HPGL_graphics(void) { fputs("\033.Y\n", outfile); /* 1 1. enable eavesdropping */ fprintf(outfile, "IN;\nSC0, %d, 0, %d;\nSR%f, %f;\n", HPGL_XMAX, HPGL_YMAX, ((float)(HPGL_HCHAR)*200/3/HPGL_XMAX), ((float)(HPGL_VCHAR)*100/2/HPGL_YMAX) ); /* 1 2 3 1. reset to power-up defaults 2. set SCaling 3. set character size */ HPGL_ang = 0; return 0; } int HPGL_text(void) { fputs("PU;\nSP0;\n\033.Z\0", outfile); /* 1 2 3 1. pen up 2. park pen 3. disable eavesdropping */ return 0; } int HPGL_linetype(int linetype) { /* allow for 6 pens */ fprintf(outfile, "PU;\nSP%d;\n", (linetype+2)%6+1); return 0; } int HP75_linetype(int linetype) { /* allow for 4 pens */ fprintf(outfile, "PU;\nSP%d;\n", (linetype+2)%4+1); return 0; } /* some early HPGL plotters (e.g. HP7220C) require the * Pen Up/Down and Pen (move) Absolute commands to be separate */ int HPGL_move(int x, int y) { fprintf(outfile, "PU;PA%d, %d;\n", x, y); return 0; } int HPGL_vector(int x, int y) { fprintf(outfile, "PD;PA%d, %d;\n", x, y); return 0; } int HPGL_put_text(int x, int y, char *str) { if (HPGL_ang == 1) HPGL_move(x + HPGL_VCHAR/4, y); else HPGL_move(x, y - HPGL_VCHAR/4); fprintf(outfile, "LB%s\003\n", str); return 0; } int HPGL_text_angle(int ang) { HPGL_ang = ang; if (ang == 1) /* vertical */ fprintf(outfile, "DI0, 1;\n"); else /* horizontal */ fprintf(outfile, "DI1, 0;\n"); return TRUE; } int HPGL_reset(void) { return 0; }