aboutsummaryrefslogtreecommitdiff
path: root/sys/pmio/pmpolygon.x
blob: 5e09e5b7c1f6a21d0b016cd689f6c291b36d99ff (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <pmset.h>
include	<plio.h>

# PM_POLYGON -- Perform a rasterop operation on the area enclosed by a polygon
# drawn in a 2-dimensional plane of a mask.  If the dimensionality of the mask
# exceeds 2, the pm_setplane() procedure should be called first to define the
# plane of the mask to be modified.

procedure pm_polygon (pl, x, y, npts, rop)

pointer	pl			#I mask descriptor
int	x[npts]			#I polygon x-vertices
int	y[npts]			#I polygon y-vertices
int	npts			#I number of points in polygon
int	rop			#I rasterop defining operation

int	i
pointer	sp, xp, yp
errchk	pl_getplane
include	"pmio.com"

begin
	if (PM_MAPXY(pl) == YES) {
	    call smark (sp)
	    call salloc (xp, npts, TY_INT)
	    call salloc (yp, npts, TY_INT)

	    call pl_getplane (pl, v1)
	    do i = 1, npts {
		v1[1] = x[i];  v1[2] = y[i]
		call imaplv (PM_REFIM(pl), v1, v2, PM_MAXDIM)
		Memi[xp+i-1] = v2[1];  Memi[yp+i-1] = v2[2]
	    }

	    call pl_polygon (pl, Memi[xp], Memi[yp], npts, rop)
	    call sfree (sp)

	} else
	    call pl_polygon (pl, x, y, npts, rop)
end