ggiMapColor, ggiUnmapPixel, ggiPackColors, ggiUnpackPixels — Convert from ggi_color(s) to ggi_pixel(s) and vice versa
#include <ggi/ggi.h>
ggi_pixel ggiMapColor( | vis, | |
col) ; |
ggi_visual_t | vis; |
ggi_color * | col; |
int ggiUnmapPixel( | vis, | |
pixel, | ||
col) ; |
ggi_visual_t | vis; |
ggi_pixel | pixel; |
ggi_color * | col; |
int ggiPackColors( | vis, | |
buf, | ||
cols, | ||
len) ; |
ggi_visual_t | vis; |
void * | buf; |
ggi_color * | cols; |
int | len; |
int ggiUnpackPixels( | vis, | |
buf, | ||
cols, | ||
len) ; |
ggi_visual_t | vis; |
void * | buf; |
ggi_color * | cols; |
int | len; |
ggiMapColor gets the pixelvalue for the given color.
ggiUnmapPixel gets the color associated with the given pixelvalue.
ggiPackColors converts the colors in cols to pixelvalues in buf. The output from this function is suitable for input to the ggiPut{HLine,VLine,Box} functions.
ggiUnpackPixels converts the pixelvalues in buf to individual elements of cols. This function maybe used to convert buffers output by the ggiGet{HLine,VLine,Box} functions from the pixelvalue representation to their actual colors.
The buffers output from ggiPackColors and the input to ggiUnpackPixels are in the same format as the get/put buffers. Their format is defined in ggi_pixelformat.
Try to cache the results of color lookups in your application for efficiency purposes.
ggiMapColor returns a ggi_pixel.
ggiUnmapPixel, ggiPackColors, and ggiUnpackPixels returns 0 for OK, otherwise an error code.