gePixelFormat

Types:

typedef uint32 (*gePixelFormat_Composer )(int R,int G,int B,int A);

typedef void (*gePixelFormat_Decomposer)(uint32 Pixel,int *R,int *G,int *B,int *A);
 

typedef void (*gePixelFormat_ColorGetter)(uint8 **ppData,int *R,int *G,int *B,int *A);

typedef void (*gePixelFormat_ColorPutter)(uint8 **ppData,int  R,int  G,int  B,int  A);

typedef uint32 (*gePixelFormat_PixelGetter)(uint8 **ppData);

typedef void (*gePixelFormat_PixelPutter)(uint8 **ppData,uint32 Pixel);

gePixelFormat_Operations;

typedef struct gePixelFormat_Operations{
    uint32 RMask;
    uint32 GMask;
    uint32 BMask;
    uint32 AMask;

    int  RShift;
    int  GShift;
    int  BShift;
    int  AShift;

    int  RAdd;
    int  GAdd;
    int  BAdd;
    int  AAdd;

    int   BytesPerPel;
    geBoolean HasPalette;
    char *  Description;

    gePixelFormat_Composer  ComposePixel;
    gePixelFormat_Decomposer DecomposePixel;

    gePixelFormat_ColorGetter GetColor;
    gePixelFormat_ColorPutter PutColor;

    gePixelFormat_PixelGetter GetPixel;
    gePixelFormat_PixelPutter PutPixel;
} gePixelFormat_Operations;
 

Constants:

gePixelFormat;

typedef enum{
    GE_PIXELFORMAT_NO_DATA = 0,
    GE_PIXELFORMAT_8BIT,    // PAL
    GE_PIXELFORMAT_8BIT_GRAY,  // no palette (intensity from bit value)
    GE_PIXELFORMAT_16BIT_555_RGB,
    GE_PIXELFORMAT_16BIT_555_BGR,
    GE_PIXELFORMAT_16BIT_565_RGB, // #5
    GE_PIXELFORMAT_16BIT_565_BGR,
    GE_PIXELFORMAT_16BIT_4444_ARGB, // #7
    GE_PIXELFORMAT_16BIT_1555_ARGB,
    GE_PIXELFORMAT_24BIT_RGB,  // #9
    GE_PIXELFORMAT_24BIT_BGR,
    GE_PIXELFORMAT_24BIT_YUV,  // * see note below
    GE_PIXELFORMAT_32BIT_RGBX,
    GE_PIXELFORMAT_32BIT_XRGB,
    GE_PIXELFORMAT_32BIT_BGRX,
    GE_PIXELFORMAT_32BIT_XBGR,
    GE_PIXELFORMAT_32BIT_RGBA,
    GE_PIXELFORMAT_32BIT_ARGB,  // #17
    GE_PIXELFORMAT_32BIT_BGRA,
    GE_PIXELFORMAT_32BIT_ABGR,

    GE_PIXELFORMAT_WAVELET,   // #20 , Wavelet Compression

    GE_PIXELFORMAT_COUNT
} gePixelFormat;

Notes:
    from PIXELFORMAT.H:  There's something wacked out about these format names: for 16 bit & 32 bit , the _RGB or _BGR refers to their order *in the word or dword* ; since we're on intel, this means the bytes in the data file have the *opposite* order !!  (for example the 32 bit _ARGB is actually B,G,R,A in raw bytes) for 24 bit , the _RGB or _BGR refers to their order in the actual bytes, so that windows bitmaps actually have _RGB order in a dword !!
    * YUV : the pixelformat ops here are identical to those of 24bit_RGB; this is just a place-keeper to notify you that you should to a YUV_to_RGB conversion


GE_PIXELFORMAT_8BIT_PAL;

#define GE_PIXELFORMAT_8BIT_PAL GE_PIXELFORMAT_8BIT


Functions:

GENESISAPI unsigned int GENESISCC gePixelFormat_BytesPerPel(gePixelFormat Format);

This function returns the number of bytes per pixel for the specified gePixelFormat.

Returns: the result.


GENESISAPI uint32 GENESISCC gePixelFormat_ComposePixel(gePixelFormat Format, int R, int G, int B, int A);

This function produces a uint32 pixel of the specified format from the specified (R,G,B,A) parameters.

Returns: the created uint32 pixel.


GENESISAPI uint32 GENESISCC gePixelFormat_ConvertPixel(gePixelFormat Format, uint32 Pixel, gePixelFormat ToFormat);

This function converts the given uint32 pixel Pixel from Format to ToFormat.

Returns: the result


GENESISAPI void GENESISCC gePixelFormat_DecomposePixel(gePixelFormat Format, uint32 Pixel, int *R, int *G, int *B, int *A);

This function returns the (R,G,B,A) parameters of Pixel given that Pixel is of pixel format Format.

Returns: nothing.


GENESISAPI const char *GENESISCC gePixelFormat_Description(gePixelFormat Format);

This function returns a text description of the given gePixelFormat Format.

Returns: the text description.


GENESISAPI void GENESISCC gePixelFormat_GetColor(gePixelFormat Format, uint8 **ppData, int *R, int *G, int *B, int *A);

This function returns the (R,G,B,A) parameters of the pixel pointed to by ppData if it is translated as being of Format pixel format and increments ppData by one pixel.

Returns: nothing.


GENESISAPI const gePixelFormat_Operations *GENESISCC gePixelFormat_GetOperations(gePixelFormat Format);

This function returns the gePixelFormat_Operations structure for the given pixel format.

Returns: the gePixelFormat_Operations structure.


GENESISAPI uint32 GENESISCC gePixelFormat_GetPixel(gePixelFormat Format, uint8 **ppData);

This function returns the uint32 pixel pointed to by ppData given that it is stored in Format pixel format and increments ppData by one pixel.

Returns: the uint32 pixel.


GENESISAPI geBoolean GENESISCC gePixelFormat_HasAlpha(gePixelFormat Format);

This function tests whether the specified gePixelFormat supports Alpha.

Returns: GE_TRUE if it supports Alpha, GE_FALSE otherwise.


GENESISAPI geBoolean GENESISCC gePixelFormat_HasGoodAlpha(gePixelFormat Format);

This function checks whether the specified gePixelFormat specifies more than one bit of Alpha.

Returns: GE_TRUE if it supports more than one bit of Alpha, GE_FALSE otherwise.

Notes:
    from PIXELFORMAT.H: more than 1 bit of alpha.


GENESISAPI geBoolean GENESISCC gePixelFormat_HasPalette(gePixelFormat Format);

This function checks whether the given gePixelFormat is palettized.

Returns: GE_TRUE if pixel format is palettized, GE_FALSE otherwise.


GENESISAPI geBoolean GENESISCC gePixelFormat_IsRaw(gePixelFormat Format);

This function tests whether the given gePixelFormat supports the compose functions.

Returns: GE_TRUE if pixel format supports compose, GE_FALSE otherwise.

Notes:
    from PIXELFORMAT.H: 'Raw' means pixels can be made with the Compose operations


GENESISAPI geBoolean GENESISCC gePixelFormat_IsValid(gePixelFormat Format);

This function checks whether the specified gePixelFormat is a valid gePixelFormat.  I assume this means that it checks whether the constant specified represents a valid gePixelFormat (i.e. listed in the enum).

Returns: GE_TRUE if Format is a valid gePixelFormat, GE_FALSE otherwise.


GENESISAPI void GENESISCC gePixelFormat_PutColor(gePixelFormat Format, uint8 **ppData, int R, int G, int B, int A);

This function colors the pixel pointed to by ppData (R,G,B,A) utilizing the specified gePixelFormat and increments ppData by one pixel.

Returns: nothing.


GENESISAPI void GENESISCC gePixelFormat_PutPixel(gePixelFormat Format, uint8 **ppData, uint32 Pixel);

This function puts the raw uint32 pixel Pixel into ppData utilizing the gePixelFormat Format and increments ppData by one pixel.

Returns: nothing.

Notes:
    from PIXELFORMAT.H: the Masks double as boolean "HaveAlpha" .. etc..