aboutsummaryrefslogtreecommitdiff
path: root/man/man3/color.3
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-04-10 18:53:55 +0000
committerrsc <devnull@localhost>2004-04-10 18:53:55 +0000
commitcfa37a7b1131abbab2e7d339b451f5f0e3198cc8 (patch)
treea7fe52416e9d27efe2af2d54910112674c0fd7c6 /man/man3/color.3
parent08df2a433e69c94f9db002c83380cb2b693fee60 (diff)
downloadplan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.tar.gz
plan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.tar.bz2
plan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.zip
Lots of man pages.
Diffstat (limited to 'man/man3/color.3')
-rw-r--r--man/man3/color.356
1 files changed, 56 insertions, 0 deletions
diff --git a/man/man3/color.3 b/man/man3/color.3
new file mode 100644
index 00000000..91d34a62
--- /dev/null
+++ b/man/man3/color.3
@@ -0,0 +1,56 @@
+.TH COLOR 3
+.SH NAME
+cmap2rgb, cmap2rgba, rgb2cmap \- colors and color maps
+.SH SYNOPSIS
+.B #include <u.h>
+.br
+.B #include <libc.h>
+.br
+.B #include <draw.h>
+.PP
+.B
+int rgb2cmap(int red, int green, int blue)
+.PP
+.B
+int cmap2rgb(int col)
+.PP
+.B
+int cmap2rgba(int col)
+.SH DESCRIPTION
+These routines convert between `true color' red/green/blue triples and the Plan 9 color map.
+See
+.IR color (6)
+for a description of RGBV, the standard color map.
+.PP
+.I Rgb2cmap
+takes a trio of color values, scaled from 0 (no intensity) to 255 (full intensity),
+and returns the index of the color in RGBV closest to that represented
+by those values.
+.PP
+.I Cmap2rgb
+decomposes the color of RGBV index
+.I col
+and returns a 24-bit integer with the low 8 bits representing the blue value,
+the next 8 representing green, and the next 8 representing red.
+.I Cmap2rgba
+decomposes the color of RGBV index
+.I col
+and returns a 32-bit integer with the low 8 bits representing an alpha value,
+defined to be 255,
+and the next 8 representing blue, then green, then red, as for
+.I cmap2rgba
+shifted up 8 bits.
+This 32-bit representation is the format used by
+.IR draw (2)
+and
+.IR memdraw (2)
+library routines that
+take colors as arguments.
+.SH SOURCE
+.B /sys/src/libdraw
+.SH SEE ALSO
+.IR graphics (2),
+.IR allocimage (2),
+.IR draw (2),
+.IR image (6),
+.IR color (6)