File: polysegment.c

package info (click to toggle)
sam 4.3-18.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 1,440 kB
  • ctags: 1,662
  • sloc: ansic: 14,328; sh: 879; makefile: 205
file content (26 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Copyright (c) 1992 AT&T - All rights reserved. */
#include <libc.h>
#include <libg.h>
#include "libgint.h"

void
polysegment(Bitmap *d, int n, Point *pp, int v, Fcode f)
{
	XPoint *xp;
	int i;
	GC g;

	if (!(xp = (XPoint *)calloc(n, sizeof(XPoint))))
		berror("polysegment: could not allocate XPoints");
	for (i = 0; i < n; i++, pp++)
		if(d->flag&SHIFT){
			xp[i].x = pp->x - d->r.min.x;
			xp[i].y = pp->y - d->r.min.y;
		} else {
			xp[i].x = pp->x;
			xp[i].y = pp->y;
		}
	g = _getfillgc(f, d, v);
	XDrawLines(_dpy, (Drawable)d->id, g, xp, n, CoordModeOrigin);
	free(xp);
}