From 9d70f761d257857c896cff683236def3bf1133b3 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Mon, 23 May 2011 21:36:38 +0200 Subject: [PATCH] Tweak PixelType definitons --- core/GP_Pixel.h | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/core/GP_Pixel.h b/core/GP_Pixel.h index 5171d47f..feb7eac8 100644 --- a/core/GP_Pixel.h +++ b/core/GP_Pixel.h @@ -56,6 +56,18 @@ typedef uint32_t GP_Pixel; #include "GP_Pixel.gen.h" /* + * Information about ordering of pixels in byte for 1, 2 and 4 bpp + * used in a one bit variable in GP_Context + */ + +typedef enum { + /* less significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_LE = 0, + /* more significant bits contain pixels with lower indices */ + GP_BIT_ENDIAN_BE, +} GP_BIT_ENDIAN; + +/* * Description of one channel * Assumes all the channel names to be at most 7 chars long * @@ -68,45 +80,41 @@ typedef uint32_t GP_Pixel; typedef struct { char name[8]; /* Channel name */ - int offset; /* Offset in bits */ - int size; /* Bit-size */ + uint8_t offset; /* Offset in bits */ + uint8_t size; /* Bit-size */ } GP_PixelTypeChannel; /* + * Maximum number of channels in a PixelType + */ + +#define GP_PIXELTYPE_MAX_CHANNELS 8 + +/* * Description of one PixelType * Assumes name with at most 15 chars * Assumes at most 8 channels */ typedef struct { - GP_PixelType type; /* Number of the type */ - const char name[16]; /* Name */ - int size; /* Size in bits */ - int bit_endian; /* Order of pixels in a byte */ /**TODO : add proper type !! */ - int numchannels; /* Number of channels */ - const char bitmap[36]; /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ - const GP_PixelTypeChannel channels[8]; /* Individual channels */ + GP_PixelType type; /* Number of the type */ + const char name[16]; /* Name */ + uint8_t size; /* Size in bits */ + GP_BIT_ENDIAN bit_endian; /* Order of pixels in a byte */ + uint8_t numchannels; /* Number of channels */ + /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ + const char bitmap[sizeof(GP_Pixel) * 8 + 1]; + /* Individual channels */ + const GP_PixelTypeChannel channels[GP_PIXELTYPE_MAX_CHANNELS]; } GP_PixelTypeDescription; /* - * Array of GP_PIXEL_MAX entries + * Array of size GP_PIXEL_MAX describing known pixel types */ extern const GP_PixelTypeDescription const GP_PixelTypes[]; /* - * Information about ordering of pixels in byte for 1, 2 and 4 bpp - * used in a one bit variable in GP_Context - */ - -typedef enum { - /* less significant bits contain pixels with lower indices */ - GP_BIT_ENDIAN_LE = 0, - /* more significant bits contain pixels with lower indices */ - GP_BIT_ENDIAN_BE, -} GP_BIT_ENDIAN; - -/* * Convert pixel type to name. */ -- 2.11.4.GIT