URI: 
       tcolor.3 - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tcolor.3 (1338B)
       ---
            1 .TH COLOR 3
            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 .MR color (7)
           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 .MR draw (3)
           45 and
           46 .MR memdraw (3)
           47 library routines that
           48 take colors as arguments.
           49 .SH SOURCE
           50 .B \*9/src/libdraw
           51 .SH SEE ALSO
           52 .MR graphics (3) ,
           53 .MR allocimage (3) ,
           54 .MR draw (3) ,
           55 .MR image (7) ,
           56 .MR color (7)