aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/iism70/iishisto.x
blob: 374342a019283d5b02929b72271fb96afa734da3 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <mach.h>
include "iis.h"
include "../lib/ids.h"

# IISHISTO -- Activate, Read histogram.

procedure iishisto (rw, color, offset, a_n, data)

short	rw			# read or write
short	color[ARB]		# color(s) to write
short	offset			# offset into histogram table
short	a_n			# number of data values
short	data[ARB]		# the data

int	n, command, off, len, x, y, z
include "iis.com"

begin
	n = a_n
	if (n < 1) 
	    return

	# set the area to be histogrammed ... in data[1], currently
	# device very specific  ( 2 == whole region) .  Need to fix this
	# perhaps via specific graph plane filled with gkifill command to
	# depict area desired.
	# n must be twice the number of datum values.  Upper level code
	# must know this to leave enough room.  Would be better if upper
	# code could ignore this (fact).

	if (rw == IDS_WRITE) {
	    command = IWRITE+VRETRACE
	    x = 0
	    y = 0
	    z = 0
	    len = 1
	    data[1] = 2
	    call iishdr (command, len, VIDEOM+COMMAND, x, y, z, 0)
	    call iisio (data[1], len * SZB_CHAR)
	    return
	}

	off = offset
	command = IREAD+VRETRACE
	len = min (n, LEN_VIDEOM-off+1)
	off = min (LEN_VIDEOM, off) - 1
	y = off/MAXX + ADVYONXOV
	x = mod (off, MAXX) + ADVXONTC
	call iishdr (command, len, VIDEOM, x, y, z, 0)
	call iisio (data, len * SZB_CHAR)
end