16#ifndef CORE_GP_PIXEL_H
17#define CORE_GP_PIXEL_H
24#define GP_PIXEL_BITS (sizeof(gp_pixel) * 8)
86 const char bitmap[GP_PIXEL_BITS + 1];
96#define GP_VALID_PIXELTYPE(type) (((type) > 0) && ((type) < GP_PIXEL_MAX))
98#define GP_CHECK_VALID_PIXELTYPE(type) \
99 GP_CHECK(GP_VALID_PIXELTYPE(type), "Invalid PixelType %d", (type))
104static inline const char *gp_pixel_type_name(
gp_pixel_type type)
106 GP_CHECK_VALID_PIXELTYPE(type);
115 GP_CHECK_VALID_PIXELTYPE(type);
121 GP_CHECK_VALID_PIXELTYPE(type);
125static inline unsigned int gp_pixel_channel_count(
gp_pixel_type type)
127 GP_CHECK_VALID_PIXELTYPE(type);
131static inline uint8_t gp_pixel_channel_bits(
gp_pixel_type type, uint8_t channel)
133 GP_CHECK_VALID_PIXELTYPE(type);
137static inline const char *gp_pixel_channel_name(
gp_pixel_type type,
140 GP_CHECK_VALID_PIXELTYPE(type);
177 uint8_t bits_per_pixel);
200 uint32_t gsize, uint32_t goff,
201 uint32_t bsize, uint32_t boff,
202 uint32_t asize, uint32_t aoff,
203 uint8_t bits_per_pixel);
uint32_t gp_pixel
Pixel integer value.
Helper macros to get and set bits given offset and length.
A pixel defintions generated from gen/include/gfxprim_config.py.
#define GP_PIXEL_CHANS_MAX
Maximal number of channels per all defined pixel types.
gp_pixel_type
List of all pixel types.
@ GP_PIXEL_MAX
Last valid pixel type has value GP_PIXEL_MAX-1.
int gp_pixel_has_flags(gp_pixel_type pixel_type, gp_pixel_flags flags)
Function to determine pixel attributes.
gp_pixel gp_pixel_chan_mask(gp_pixel_type pixel_type, const char *chan_name)
Returns channel mask for a given pixel type and channel name.
const gp_pixel_type_desc gp_pixel_types[GP_PIXEL_MAX]
Array with description for all pixel types.
gp_pixel gp_pixel_chans_add(gp_pixel_type pixel_type, gp_pixel pixel, int add)
Does per-channel saturated addition.
gp_pixel_type gp_pixel_rgb_match(gp_pixel rmask, gp_pixel gmask, gp_pixel bmask, gp_pixel amask, uint8_t bits_per_pixel)
Matches a RGB pixel type againts known pixel types.
gp_pixel_type gp_pixel_rgb_lookup(uint32_t rsize, uint32_t roff, uint32_t gsize, uint32_t goff, uint32_t bsize, uint32_t boff, uint32_t asize, uint32_t aoff, uint8_t bits_per_pixel)
Looks up a RGB pixel type against know pixel types.
gp_pixel_flags
Pixel type flags for various pixel properties.
@ GP_PIXEL_IS_PALETTE
Pixel is palette.
@ GP_PIXEL_HAS_ALPHA
Pixel has an alpha channel.
@ GP_PIXEL_IS_CMYK
Pixel has CMYK channels.
@ GP_PIXEL_IS_GRAYSCALE
Pixel is grayscale.
@ GP_PIXEL_IS_RGB
Pixel has RGB channels.
Description of one pixel channel.
A description of a gp_pixel_type Assumes name with at most 15 chars.
const gp_pixel_channel channels[4]
An individual channel descriptions.
uint8_t pack
A pixel packing.
const char bitmap[(sizeof(gp_pixel) *8)+1]
String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")
gp_pixel_flags flags
Bitwise or of gp_pixel_flags.
uint8_t size
A pixel size in bits.
const char name[16]
A name e.g. xRGB8888.
gp_pixel_type type
An id of the pixel type.
uint8_t numchannels
A number of channels.