aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gim/gimqras.x
blob: fa8f59099d6d488bef4b697e4ae7ca62ffdb5372 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<syserr.h>
include	<gescape.h>
include	<fset.h>
include	<gio.h>

# GIM_QUERYRASTER -- Query a raster.  The function value (YES/NO) indicates
# whether or not the raster exists.  If the raster exists, the raster type
# and size are returned as output arguments.

int procedure gim_queryraster (gp, raster, type, width, height, depth)

pointer	gp			#I graphics descriptor
int	raster			#I raster number (0 is display window)
int	type			#O raster type (ximage,pixmap)
int	width			#O raster width in pixels
int	height			#O raster height in pixels
int	depth			#O raster depth, bits per pixel

int	nchars, nread
short	gim[GIM_QUERYRASTER_LEN]
short	retval[GIM_RET_QRAS_LEN]
errchk	gescape, flush, read, syserrs
int	read()

begin
	call gpl_flush()
	gim[GIM_QUERYRASTER_RN] = raster
	call gescape (gp, GIM_QUERYRASTER, gim, GIM_QUERYRASTER_LEN)
	call flush (GP_FD(gp))

	# This assumes a normal stream type GKI connection.
	nchars = GIM_RET_QRAS_LEN * SZ_SHORT
	nread = read (GP_FD(gp), retval, nchars)
	call fseti (GP_FD(gp), F_CANCEL, OK)
	if (nread != nchars)
	    call syserrs (SYS_FREAD, "gim_queryraster")

	type   = retval[GIM_RET_QRAS_RT]
	width  = retval[GIM_RET_QRAS_NX]
	height = retval[GIM_RET_QRAS_NY]
	depth  = retval[GIM_RET_QRAS_BP]

	return (retval[GIM_RET_QRAS_EX])
end