ggi_color(3)

NAME
ggi_color, ggi_pixel : LibGGI color description

SYNOPSIS
#include <ggi/ggi.h>
typedef struct { uint16_t r,g,b,a; }   ggi_color;
typedef uint32_t   ggi_pixel;

DESCRIPTION
Colors in ggi are described generically through the display-independent ggi_color structure. 16 bit channels are used to ensure sufficient precision on most displays. ggi_pixels are display-dependent pixel values. They are used by all GGI drawing primitives for efficiency. Use ggiMapColor(3) to convert ggi_colors to ggi_pixels.

STRUCTURE MEMBERS
r, g and b correspond to the red, green and blue channels. Since libggi does not deal with alpha compositing, the a (alpha) field is mainly there for padding and it is not used by libggi. Setting this value has no effect in libggi itself, and it will most probably not be unmapped correctly from ggi_pixels. However, some extensions might make use of it, in which case you should refer to their documentation. ggi_pixels format depends on the actual display and mode. For those who want to operate directly on pixel values, this format is described in the ggi_pixelformat(3) structure.

PIXEL ARRAYS
Although individual pixels are kept into 32 bits ggi_pixel, arrays of pixels, as used in ggi[Get|Put]* functions, ggiPackColors(3) and ggiUnpackPixels(3), are stored in the display specific format, thus packed according to the actual pixel size. This size is given by the GT_SIZE macro for graphtype or the size field of the ggi_pixelformat(3) structure. The buffers provided to these functions must be big enough to store or read enough pixels. Although it is safe to use 32 bits per pixel, the optimum size (in bits) can be calculated by multiplying the number of pixel by their size. Don't forget to round up to a multiple of 8 to get the number of bytes. If you want to access such buffers directly, do not use pointer arithmetics with ggi_pixels.

SEE ALSO
ggiMapColor(3), ggi_mode(3), ggi_pixelformat(3)