aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gmark.x
blob: a9517b79e95118ee7018e8e2809fb886794a2059 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<gset.h>
include	<gio.h>

# GMARK -- Draw a marker of the indicated type and size.  A mark is represented
# as a polyline normalized to the unit square.  Drawing a mark is a simple
# matter of drawing this normalized polyline in a window the size and position
# of the mark.  While the mark window defines the transformation upon the
# normalized marker polyline, clipping is performed on the WCS viewport boundary
# (if enabled), independently of the size and position of the mark.  Redrawing
# a mark with a linetype of clear will erase the mark, device permitting.
# Drawing is carried out in world coordinates, hence the marker shape will
# relect logarithmic scaling if in effect.

procedure gmark (gp, x, y, marktype, xsize, ysize)

pointer	gp			# graphics descriptor
real	x, y			# world coordinates of center of marker
int	marktype		# type of marker to be drawn
real	xsize, ysize		# marker size in X and Y

int	i, m, fill
int	and()
include	"markers.inc"

begin
	# The point marker type cannot be combined with the other types and
	# is treated as a special case.  The remaining markers are drawn
	# using GUMARK, which draws marks represented as polygons

	if (marktype == GM_POINT || (xsize == 0 && ysize == 0)) {
	    call gpl_settype (gp, POLYMARKER)
	    call gamove (gp, x, y)
	    call gadraw (gp, x, y)
	    call gpl_settype (gp, POLYLINE)

	} else {
	    # Some marks can be drawn using area fill.
	    if (and (marktype, GM_FILL) != 0)
		fill = YES
	    else
		fill = NO

	    # Draw and overlay each mark.  The polylines for the standard
	    # marks are stored in MPX and MPY at offsets MXO and MYO.

	    do i = GM_FIRSTMARK, GM_LASTMARK
		if (and (marktype, 2 ** i) != 0) {
		    m = i - GM_FIRSTMARK + 1
		    call gumark (gp, mpx[moff[m]], mpy[moff[m]], mnpts[m],
			x, y, xsize, ysize, fill)
		}
	}
end