33 #define ror(x,n) ((x >> n) | (x << (8-n))) 34 #define swap(a,b) {int t=a; a=b; b=t;} 66 plotfile = fopen((
char*)graph->devdep,
"wb");
69 graph->devdep = (
char *)
NULL;
73 hp = (
struct hplaser*)graph->devdep;
75 switch (graph->graphtype) {
91 bpline = (graph->absolute.width + 7)/8;
93 hp->
base =
malloc(graph->absolute.height*bpline);
98 memset(hp->
base,0,graph->absolute.height*bpline);
100 graph->fontwidth = 15;
101 graph->fontheight = 30;
104 hp->
maxx = graph->absolute.width - 1;
105 hp->
maxy = graph->absolute.height - 1;
126 char *
buf, *rgen, *
c;
139 "\033E\033&l0E\033*p%dX\033*p%dY\033*t%dR\033*r1A",
143 sprintf(buf,
"\033*b%dW",hp->
bytpline);
148 for (i = 0; i <= hp->
maxy; i++) {
164 fprintf(
plotfile,
"\033*p%dX\033*p%dY%s",
175 fprintf(
plotfile,
"\033*rB\014\033E");
205 int dx, dy, dy2, errterm = 0,
next, lcnt;
207 unsigned char cbuf, left, right;
218 lcnt = hp->
maxy - y1;
219 rgen = hp->
base + (x1 >> 3) + lcnt*
next;
220 left = 0x80 >> ((lcnt+x1) & 7);
229 cbuf = 0x80 >> (x1 & 7);
231 for (dy++; dy; dy--) {
234 if (left & right) *rgen |= cbuf;
239 while (errterm > 0 && x1 != x2) {
240 if (left & right) *rgen |= cbuf;
243 if (cbuf & 0x80) rgen++;
272 double theta1, theta2;
283 int i, n = 2*p->nvertices - 2;
285 for (i = 0; i < n; i += 2)
286 HP_Line(p->xy[i],p->xy[i+1],p->xy[i+2],p->xy[i+3]);
304 hpt->text =
copy(text);
314 int linestyleid, mask;
static char buf[MAXPROMPT]
internalerror(char *message)
int HP_Arc(int x0, int y0, int radius, double theta1, double theta2)
int HP_DefineLinestyle(int linestyleid, int mask)
int HP_Polygon(POLYGON *p)
int HP_Line(int x1, int y1, int x2, int y2)
int HP_SetLinestyle(int linestyleid)
int HP_Pixel(int x, int y)
int HP_Box(int x1, int y1, int x2, int y2)
int HP_NewViewport(GRAPH *graph)
unsigned char linestyle_stored
int HP_Text(char *text, int x, int y)