1 058b0118 2005-01-03 devnull .TH READCOLMAP 3
3 058b0118 2005-01-03 devnull RGB, readcolmap, writecolmap \- access display color map
4 058b0118 2005-01-03 devnull .SH SYNOPSIS
5 058b0118 2005-01-03 devnull .B #include <u.h>
7 058b0118 2005-01-03 devnull .B #include <libc.h>
9 058b0118 2005-01-03 devnull .B #include <draw.h>
12 058b0118 2005-01-03 devnull .ta \w'\fLvoid 'u
15 058b0118 2005-01-03 devnull int readcolmap(Display *d, RGB *map)
18 058b0118 2005-01-03 devnull int writecolmap(Display *d, RGB *map)
20 058b0118 2005-01-03 devnull .SH DESCRIPTION
21 058b0118 2005-01-03 devnull Colors are described by their red, green, and blue
22 058b0118 2005-01-03 devnull light intensities, in an
29 058b0118 2005-01-03 devnull struct RGB {
30 058b0118 2005-01-03 devnull ulong red;
31 058b0118 2005-01-03 devnull ulong green;
32 058b0118 2005-01-03 devnull ulong blue;
36 058b0118 2005-01-03 devnull Black is represented by zero in all three positions and
37 058b0118 2005-01-03 devnull white has the maximum
38 058b0118 2005-01-03 devnull .B unsigned
40 058b0118 2005-01-03 devnull value in all three positions.
42 058b0118 2005-01-03 devnull A color map is an array of
43 058b0118 2005-01-03 devnull .BR RGB s,
44 058b0118 2005-01-03 devnull of length
45 058b0118 2005-01-03 devnull .if t \x'-.8n'2\u\s-1\fIdepth\fP\s+1\d,
46 058b0118 2005-01-03 devnull .if n 2^\fIdepth\fP,
47 058b0118 2005-01-03 devnull giving the colors for pixels 0, 1, 2, etc.
48 058b0118 2005-01-03 devnull On displays with color mapped pixels
49 058b0118 2005-01-03 devnull (typically 8-bit displays),
50 058b0118 2005-01-03 devnull one retrieves RGB color information
51 058b0118 2005-01-03 devnull by treating the pixel data as an offset
52 058b0118 2005-01-03 devnull into the color map.
54 058b0118 2005-01-03 devnull .I Readcolmap
55 058b0118 2005-01-03 devnull reads the color map for the given display into the provided
56 058b0118 2005-01-03 devnull .IR map ,
57 058b0118 2005-01-03 devnull which must have enough space to hold it.
58 058b0118 2005-01-03 devnull .I Writecolmap
59 058b0118 2005-01-03 devnull associates the given color map with the given display, if possible.
60 058b0118 2005-01-03 devnull (The hardware might not allow this.)
61 058b0118 2005-01-03 devnull Both return 0 on success, or \-1 on error, setting
62 058b0118 2005-01-03 devnull .IR errstr .
64 058b0118 2005-01-03 devnull Changing the hardware color map does not change
65 058b0118 2005-01-03 devnull the color map used by the
66 058b0118 2005-01-03 devnull .IR draw (3)
67 058b0118 2005-01-03 devnull operator to convert between
68 058b0118 2005-01-03 devnull mapped and true color or greyscale images,
69 058b0118 2005-01-03 devnull which is described in
70 058b0118 2005-01-03 devnull .IR color (7).
71 058b0118 2005-01-03 devnull .SH SOURCE
72 c3674de4 2005-01-11 devnull .B \*9/src/libdraw
73 058b0118 2005-01-03 devnull .SH "SEE ALSO"
74 058b0118 2005-01-03 devnull .IR graphics (3),
75 058b0118 2005-01-03 devnull .IR draw (3),
76 058b0118 2005-01-03 devnull .IR color (7)