gePixelFormat

Description: The abstract Pixel primitives

Source file: …\genesis3d\OpenSource\Source\Bitmap\pixelformat.h

Contents:

Functions: BytesPerPel, ComposePixel, ConvertPixel, DecomposePixel, Description, GetColor, GetOperations, GetPixel, HasAlpha, HasGoodAlpha, HasPalette, IsRaw, IsValid, PutColor, PutPixel

Types: gePixelFormat_Composer, gePixelFormat_Decomposer, gePixelFormat_ColorGetter, gePixelFormat_ColorPutter, gePixelFormat_PixelGetter, gePixelFormat_PixelPutter, gePixelFormat_Operations, gePixelFormat

Constants: GE_PIXELFORMAT_8BIT_PAL

Changes for Genesis3D v1.6: None

Types:

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

Return to Contents

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

Return to Contents

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

Return to Contents

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

Return to Contents

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

Return to Contents

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

Return to Contents

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;
Return to Contents
 

gePixelFormat

typedef enum{
   PIXELFORMAT_NO_DATA = 0,
   PIXELFORMAT_8BIT,    // PAL
   PIXELFORMAT_8BIT_GRAY,  // no palette (intensity from bit value)
   PIXELFORMAT_16BIT_555_RGB,
   PIXELFORMAT_16BIT_555_BGR,
   PIXELFORMAT_16BIT_565_RGB, // #5
   PIXELFORMAT_16BIT_565_BGR,
   PIXELFORMAT_16BIT_4444_ARGB, // #7
   PIXELFORMAT_16BIT_1555_ARGB,
   PIXELFORMAT_24BIT_RGB,  // #9
   PIXELFORMAT_24BIT_BGR,
   PIXELFORMAT_24BIT_YUV,  //* see note below
   PIXELFORMAT_32BIT_RGBX,
   PIXELFORMAT_32BIT_XRGB,
   PIXELFORMAT_32BIT_BGRX,
   PIXELFORMAT_32BIT_XBGR,
   PIXELFORMAT_32BIT_RGBA,
   PIXELFORMAT_32BIT_ARGB,  // #17
   PIXELFORMAT_32BIT_BGRA,
   PIXELFORMAT_32BIT_ABGR,
   PIXELFORMAT_WAVELET,   // #20 , Wavelet Compression
   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
Return to Contents

Constants:


PIXELFORMAT_8BIT_PAL;

#define PIXELFORMAT_8BIT_PAL PIXELFORMAT_8BIT
Return to Contents


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.
Return to Contents


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.
Return to Contents


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
Return to Contents


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.
Return to Contents


GENESISAPI const char* GENESISCC gePixelFormat_Description(gePixelFormat Format);

This function returns a text description of the given gePixelFormat Format.
Returns: the text description.
Return to Contents


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.
Return to Contents


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.
Return to Contents


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.
Return to Contents


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.
Return to Contents


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.
Return to Contents


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.
Return to Contents


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
Return to Contents


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.
Return to Contents


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.
Return to Contents


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..
 
Return to Contents