aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/display/imdmapfr.x
blob: 745febe2d88113a5a1642b62870743c6334b457c (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <imset.h>
include <imhdr.h>
include <mach.h>
include <fset.h>
include	"display.h"
include	"iis.h"

# IMD_MAPFRAME -- Open the given frame of the stdimage display device on an
# IMIO image descriptor.

pointer procedure imd_mapframe (frame, mode, select_frame)

int	frame			#I frame to be opened [1:N]
int	mode			#I access mode
int	select_frame		#I make frame the display frame

pointer	ds
int	chan[MAXCHAN]
char	device[SZ_FNAME]

pointer	imdmap()
extern	imdopen()
int	imstati(), fstati(), envgets()
errchk	imdmap, imseti
include	"iis.com"

begin
	if (envgets ("stdimage", device, SZ_FNAME) == 0)
	    call error (1, "variable `stdimage' not defined in environment")

	# Pass frame number into IIS code.
	call iis_setframe (frame)

	# Map the frame onto an image descriptor.
	ds = imdmap (device, mode, imdopen)
	# call imseti (ds, IM_CLOSEFD, YES)
	chan[1] = fstati (imstati (ds, IM_PIXFD), F_CHANNEL)
	chan[2] = MONO

	# Pick up the frame size.
	iis_xdim   = IM_LEN(ds,1)
	iis_ydim   = IM_LEN(ds,2)
	iis_config = IM_LEN(ds,3)

	# Optimize for sequential i/o.
	call imseti (ds, IM_ADVICE, SEQUENTIAL)

	# Display frame being loaded?
	if (select_frame == YES)
	    call zfrmim (chan)

	return (ds)
end

# IMD_MAPFRAME1 -- Open the given frame of the stdimage display device on an
# IMIO image descriptor.
# This differs from imd_mapframe only in the addition of the erase option.

pointer procedure imd_mapframe1 (frame, mode, select_frame, erase)

int	frame			#I frame to be opened [1:N]
int	mode			#I access mode
int	select_frame		#I make frame the display frame
int	erase			#I erase frame

pointer	ds
int	chan[MAXCHAN]
char	device[SZ_FNAME]

pointer	imdmap()
extern	imdopen()
int	imstati(), fstati(), envgets()
errchk	imdmap, imseti
include	"iis.com"

begin
	if (envgets ("stdimage", device, SZ_FNAME) == 0)
	    call error (1, "variable `stdimage' not defined in environment")

	# Pass frame number into IIS code.
	call iis_setframe (frame)

	# Map the frame onto an image descriptor.
	ds = imdmap (device, mode, imdopen)
	# call imseti (ds, IM_CLOSEFD, YES)
	chan[1] = fstati (imstati (ds, IM_PIXFD), F_CHANNEL)
	chan[2] = MONO

	# Pick up the frame size.
	iis_xdim   = IM_LEN(ds,1)
	iis_ydim   = IM_LEN(ds,2)
	iis_config = IM_LEN(ds,3)

	# Optimize for sequential i/o.
	call imseti (ds, IM_ADVICE, SEQUENTIAL)

	# Display frame being loaded?
	if (select_frame == YES)
	    call zfrmim (chan)

	# Erase frame being loaded?
	if (erase == YES)
	    call zersim (chan)

	return (ds)
end