GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
COLOR(3) FreeBSD Library Functions Manual COLOR(3)

cmap2rgb, cmap2rgba, rgb2cmap - colors and color maps

#include <u.h>
#include <libc.h>
#include <draw.h>

int rgb2cmap(int red, int green, int blue)

int cmap2rgb(int col)

int cmap2rgba(int col)

These routines convert between `true color' red/green/blue triples and the Plan 9 color map. See for a description of RGBV, the standard color map.

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.

Cmap2rgb decomposes the color of RGBV index 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. Cmap2rgba decomposes the color of RGBV index 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 cmap2rgba shifted up 8 bits. This 32-bit representation is the format used by and library routines that take colors as arguments.

/src/libdraw


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.