aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/ids/testcode/grey.x
blob: a7e16b8337e20581c545e84008a49c72ec232f15 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include "imd.h"

define	DIM	512
define	MCXSCALE	64
define	MCYSCALE	64

# create a grey scale test image, using frames 1 and 2, and 
# position the cursor in the upper right quadrant.

procedure t_im()

pointer	gp
char	output[SZ_FNAME], output_file[SZ_FNAME], device[SZ_FNAME]
int	fd

pointer	gopen()
bool	streq()
int	open()

short	i,data[DIM+1]
short	display[6]
short	set_image[3]
real	y, sx, sy
int	key

begin
	call clgstr("output", output, SZ_FNAME)
	if (!streq (output, "") ) {
	    call strcpy (output, output_file, SZ_FNAME)
	    fd = open (output_file, NEW_FILE, BINARY_FILE)
	} else
	    fd = open ("dev$stdimage", NEW_FILE, BINARY_FILE)

	call clgstr("device", device, SZ_FNAME)
	gp = gopen ( device, NEW_FILE, fd)

	data[1] = IMD_R_HARD
	call gescape ( gp, IMD_RESET, data, 1)
	# display all frames off
	display[1] = IMD_OFF
	display[2] = IMD_EOD	# all frames
	display[3] = IMD_EOD	# all colors
	display[4] = IMD_EOD	# all quads
	call gescape ( gp, IMD_DISPLAY_I, display, 6)
	# display frames 1, 2 on -- 1 red, 2 green
	display[1] = IMD_ON
	display[2] = 1
	display[3] = IMD_EOD
	display[4] = IMD_RED
	display[5] = IMD_EOD
	display[6] = IMD_EOD	# all quads
	call gescape ( gp, IMD_DISPLAY_I, display, 6)
	display[1] = IMD_ON
	display[2] = 2
	display[3] = IMD_EOD
	display[4] = IMD_GREEN
	display[5] = IMD_EOD
	display[6] = IMD_EOD	# all quads
	call gescape ( gp, IMD_DISPLAY_I, display, 6)

	# now set up grey scale changing upward in frame 1
	set_image[1] = 1
	set_image[2] = IMD_EOD
	set_image[3] = IMD_EOD	# all planes
	call gescape ( gp, IMD_SET_IP, set_image, 3)
	for ( i = 1; i <= DIM ; i = i + 1 ) {
	    call amovks ( i-1, data, DIM)
	    y = real(i-1)/(DIM-1)
	    call gpcell ( gp, data, DIM, 1, 0., y, 1., y)
	}

	# grey scale changing horizontally in frame 2
	set_image[1] = 2
	call gescape ( gp, IMD_SET_IP, set_image, 3)
	do i = 1, DIM
	    data[i] = i
	call gpcell ( gp, data, DIM, 1, 0., 0., 1., 1.)

	# set the cursor
	call gscur ( gp, 0.0, 1.0)

	# read cursor
	# call ggcur( gp, sx, sy, key)

	# all done
	call gclose ( gp )
	call close ( fd )
end