Logo Search packages:      
Sourcecode: libcaca version File versions  Download package

void caca_set_bitmap_palette ( struct caca_bitmap *  bitmap,
unsigned int  red[],
unsigned int  green[],
unsigned int  blue[],
unsigned int  alpha[] 
)

Set the palette of an 8bpp bitmap object.

Set the palette of an 8 bits per pixel bitmap. Values should be between 0 and 4095 (0xfff).

Parameters:
bitmap Bitmap object.
red Array of 256 red values.
green Array of 256 green values.
blue Array of 256 blue values.
alpha Array of 256 alpha values.

Definition at line 255 of file bitmap.c.

{
    int i, has_alpha = 0;

    if(bitmap->bpp != 8)
        return;

    for(i = 0; i < 256; i++)
    {
        if(red[i] >= 0 && red[i] < 0x1000 &&
           green[i] >= 0 && green[i] < 0x1000 &&
           blue[i] >= 0 && blue[i] < 0x1000 &&
           alpha[i] >= 0 && alpha[i] < 0x1000)
        {
            bitmap->red[i] = red[i];
            bitmap->green[i] = green[i];
            bitmap->blue[i] = blue[i];
            if(alpha[i])
            {
                bitmap->alpha[i] = alpha[i];
                has_alpha = 1;
            }
        }
    }

    bitmap->has_alpha = has_alpha;
}


Generated by  Doxygen 1.6.0   Back to index