xref: /plan9/sys/src/cmd/postscript/postmd/postmd.h (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1*7dd7cddfSDavid du Colombier /*
2*7dd7cddfSDavid du Colombier  *
3*7dd7cddfSDavid du Colombier  * An interval list used to map matrix elements into integers in the range 0 to
4*7dd7cddfSDavid du Colombier  * 254 representing shades of gray on a PostScript printer. The list can be given
5*7dd7cddfSDavid du Colombier  * using the -i option or can be set in the optional header that can preceed each
6*7dd7cddfSDavid du Colombier  * matrix. The list should be a comma or space separated list that looks like,
7*7dd7cddfSDavid du Colombier  *
8*7dd7cddfSDavid du Colombier  *		num1,num2, ... ,numn
9*7dd7cddfSDavid du Colombier  *
10*7dd7cddfSDavid du Colombier  * where each num is a floating point number. The list must be given in increasing
11*7dd7cddfSDavid du Colombier  * numerical order. The n numbers in the list partion the real line into 2n+1
12*7dd7cddfSDavid du Colombier  * regions given by,
13*7dd7cddfSDavid du Colombier  *
14*7dd7cddfSDavid du Colombier  *		region1		element < num1
15*7dd7cddfSDavid du Colombier  *		region2		element = num1
16*7dd7cddfSDavid du Colombier  *		region3		element < num2
17*7dd7cddfSDavid du Colombier  *		region4		element = num3
18*7dd7cddfSDavid du Colombier  *		   .		     .
19*7dd7cddfSDavid du Colombier  *		   .		     .
20*7dd7cddfSDavid du Colombier  *		   .		     .
21*7dd7cddfSDavid du Colombier  *		region2n	element = numn
22*7dd7cddfSDavid du Colombier  *		region2n+1	element > numn
23*7dd7cddfSDavid du Colombier  *
24*7dd7cddfSDavid du Colombier  * Every number in a given region is mapped into an integer in the range 0 to 254
25*7dd7cddfSDavid du Colombier  * and that number, when displayed on a PostScript printer using the image operator,
26*7dd7cddfSDavid du Colombier  * prints as a square filled with a gray scale that reflects the integer that was
27*7dd7cddfSDavid du Colombier  * chosen. 0 maps to black and 255 white (that's why 255 is normally omitted).
28*7dd7cddfSDavid du Colombier  *
29*7dd7cddfSDavid du Colombier  * The shades of gray chosen by the program are normally generated automatically,
30*7dd7cddfSDavid du Colombier  * but can be reassigned using the -g option or by including a grayscale line in
31*7dd7cddfSDavid du Colombier  * the optional header. The grayscale list is comma or space separated list of
32*7dd7cddfSDavid du Colombier  * integers between 0 and 255 that's used to map individual regions into arbitray
33*7dd7cddfSDavid du Colombier  * shade of gray, thus overriding the default choice made in the program. The list
34*7dd7cddfSDavid du Colombier  * should look like,
35*7dd7cddfSDavid du Colombier  *
36*7dd7cddfSDavid du Colombier  *		color1,color2, ... ,color2n+1
37*7dd7cddfSDavid du Colombier  *
38*7dd7cddfSDavid du Colombier  * where color1 applies to region1 and color2n+1 applies to region2n+1. If less
39*7dd7cddfSDavid du Colombier  * than 2n+1 numbers are given the default assignments will be used for the missing
40*7dd7cddfSDavid du Colombier  * regions. Each color must be an integer in the range 0 to 255.
41*7dd7cddfSDavid du Colombier  *
42*7dd7cddfSDavid du Colombier  * The default interval list is given below. The default grayscale maps 254 (almost
43*7dd7cddfSDavid du Colombier  * white) into the first region and 0 (black) into the last.
44*7dd7cddfSDavid du Colombier  *
45*7dd7cddfSDavid du Colombier  */
46*7dd7cddfSDavid du Colombier 
47*7dd7cddfSDavid du Colombier #define DFLTILIST	"-1,0,1"
48*7dd7cddfSDavid du Colombier 
49*7dd7cddfSDavid du Colombier /*
50*7dd7cddfSDavid du Colombier  *
51*7dd7cddfSDavid du Colombier  * The active interval list is built from an interval string and stored in an array
52*7dd7cddfSDavid du Colombier  * whose elements are of type Ilist.
53*7dd7cddfSDavid du Colombier  *
54*7dd7cddfSDavid du Colombier  */
55*7dd7cddfSDavid du Colombier 
56*7dd7cddfSDavid du Colombier typedef struct  {
57*7dd7cddfSDavid du Colombier 	double	val;			/* only valid in kind is ENDPOINT */
58*7dd7cddfSDavid du Colombier 	int	color;			/* gray scale color */
59*7dd7cddfSDavid du Colombier 	long	count;			/* statistics for each region */
60*7dd7cddfSDavid du Colombier } Ilist;
61*7dd7cddfSDavid du Colombier 
62*7dd7cddfSDavid du Colombier /*
63*7dd7cddfSDavid du Colombier  *
64*7dd7cddfSDavid du Colombier  * Non-integer function declarations.
65*7dd7cddfSDavid du Colombier  *
66*7dd7cddfSDavid du Colombier  */
67*7dd7cddfSDavid du Colombier 
68*7dd7cddfSDavid du Colombier char	*savestring();
69*7dd7cddfSDavid du Colombier 
70