CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

packrgb.h File Reference

Helper routines to pack csRGBcolor/csRGBpixel into RGB/RGBA byte arrays. More...

#include "cstypes.h"
#include "rgbpixel.h"

Go to the source code of this file.

Pixel packing

When using csRGBcolor or csRGBpixel, don't assume that sizeof(csRGBcolor) == 3, sizeof(csRGBpixel) == 4 or that those struct are stored as a packed RGB/RGBA byte array.

If you need such packed RGB/RGBA data (e.g. for use with external libraries) use the functions here to convert from csRGBcolor/csRGBpixel to RGB/RGBA and vice versa. If no copy of the data is needed, they are free on platforms where sizeof(csRGBcolor) == 3, sizeof(csRGBpixel) == 4 are true. In any other case copying/packing the data is handled appropriately.

uint8csPackRGBcolorToRGB (const csRGBcolor *pixels, int numPixels)
 Pack an array of csRGBcolor into a RGB byte array. More...

void csDiscardPackedRGB (const uint8 *rgb)
 Frees memory possibly allocated by csPackRGBcolorToRGB(). More...

const csRGBcolorcsUnpackRGBtoRGBcolor (const uint8 *rgb, int numPixels)
 Unpack a RGB byte array into an array of csRGBcolor. More...

void csDiscardUnpackedRGBcolor (const csRGBcolor *pixels)
 Frees memory possibly allocated by csUnpackRGBtoRGBcolor(). More...

const uint8csPackRGBpixelToRGBA (const csRGBpixel *pixels, int numPixels)
 Pack an array of csRGBpixel into a RGBA byte array. More...

void csDiscardPackedRGBA (const uint8 *rgba)
 Frees memory possibly allocated by csPackRGBpixelToRGBA(). More...

const csRGBpixelcsUnpackRGBAtoRGBpixel (const uint8 *rgba, int numPixels)
 Unpack a RGBA byte array into an array of csRGBpixel. More...

csRGBpixelcsCopyUnpackRGBAtoRGBpixel (const uint8 *rgba, int numPixels)
 Unpack a RGBA byte array into an array of csRGBpixel. More...

void csDiscardUnpackedRGBpixel (const csRGBpixel *pixels)
 Frees memory possibly allocated by csUnpackRGBAtoRGBpixel(). More...

uint8csPackRGBpixelToRGB (const csRGBpixel *pixels, int numPixels)
 Pack an array of csRGBpixel into a RGB byte array. More...

csRGBcolorcsUnpackRGBAtoRGBcolor (const uint8 *rgba, int numPixels)
 Unpack a RGBA byte array into an array of csRGBcolor. More...


Detailed Description

Helper routines to pack csRGBcolor/csRGBpixel into RGB/RGBA byte arrays.

Definition in file packrgb.h.


Generated for Crystal Space by doxygen 1.2.14