Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH COLOR 2
2
.SH NAME
3
cmap2rgb, cmap2rgba, rgb2cmap \- colors and color maps
4
.SH SYNOPSIS
5
.B #include <u.h>
6
.br
7
.B #include <libc.h>
8
.br
9
.B #include <draw.h>
10
.PP
11
.B
12
int	rgb2cmap(int red, int green, int blue)
13
.PP
14
.B
15
int	cmap2rgb(int col)
16
.PP
17
.B
18
int	cmap2rgba(int col)
19
.SH DESCRIPTION
20
These routines convert between `true color' red/green/blue triples and the Plan 9 color map.
21
See
22
.IR color (6)
23
for a description of RGBV, the standard color map.
24
.PP
25
.I Rgb2cmap
26
takes a trio of color values, scaled from 0 (no intensity) to 255 (full intensity),
27
and returns the index of the color in RGBV closest to that represented
28
by those values.
29
.PP
30
.I Cmap2rgb
31
decomposes the color of RGBV index
32
.I col
33
and returns a 24-bit integer with the low 8 bits representing the blue value,
34
the next 8 representing green, and the next 8 representing red.
35
.I Cmap2rgba
36
decomposes the color of RGBV index
37
.I col
38
and returns a 32-bit integer with the low 8 bits representing an alpha value,
39
defined to be 255,
40
and the next 8 representing blue, then green, then red, as for
41
.I cmap2rgba
42
shifted up 8 bits.
43
This 32-bit representation is the format used by 
44
.IR draw (2)
45
and
46
.IR memdraw (2)
47
library routines that
48
take colors as arguments.
49
.SH SOURCE
50
.B /sys/src/libdraw
51
.SH SEE ALSO
52
.IR graphics (2),
53
.IR allocimage (2),
54
.IR draw (2),
55
.IR image (6),
56
.IR color (6)