![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Data Structures | |
| struct | gp_pixmap |
| A pixmap buffer. More... | |
Macros | |
| #define | GP_PIXEL_IS_CLIPPED(pixmap, x, y) |
| Returns true when pixel is clipped out of pixmap. | |
Functions | |
| gp_pixmap * | gp_pixmap_alloc_ex (gp_size w, gp_size h, gp_pixel_type type, uint32_t stride) |
| Allocates a pixmap. | |
| static gp_pixmap * | gp_pixmap_alloc (gp_size w, gp_size h, gp_pixel_type type) |
| Allocates a pixmap. | |
| int | gp_pixmap_correction_set (gp_pixmap *self, gp_correction_desc *corr_desc) |
| Sets a correction for the pixmap. | |
| static int | gp_pixmap_gamma_set (gp_pixmap *self, float gamma) |
| Sets a gamma correction for the pixmap. | |
| static int | gp_pixmap_srgb_set (gp_pixmap *self) |
| Sets a sRGB correction for the pixmap. | |
| void | gp_pixmap_free (gp_pixmap *self) |
| Frees a pixmap. | |
| static gp_pixmap * | gp_pixmap_from_data (gp_size w, gp_size h, gp_pixel_type type, void *pixels, enum gp_pixmap_init_flags flags) |
| Creates a pixmap from a buffer allocated by malloc(). | |
| #define GP_PIXEL_IS_CLIPPED | ( | pixmap, | |
| x, | |||
| y ) |
Returns true when pixel is clipped out of pixmap.
This macro does not take into account the rotation flags. Pixel has to be rotated with GP_TRANSFORM_POINT() first.
Definition at line 131 of file gp_pixmap.h.
|
inlinestatic |
Allocates a pixmap.
This is a shortcut for gp_pixmap_alloc_ex() without the stride parameter (stride set to 0 to be determined by the library).
| w | A pixmap width. |
| h | A pixmap height. |
| type | A pixel type. |
Definition at line 185 of file gp_pixmap.h.
References gp_pixmap_alloc_ex().
| gp_pixmap * gp_pixmap_alloc_ex | ( | gp_size | w, |
| gp_size | h, | ||
| gp_pixel_type | type, | ||
| uint32_t | stride ) |
Allocates a pixmap.
The pixmap consists of two parts, the gp_pixmap structure and pixels buffer.
Upon creation the pixmap rotation flags are set to (0, 0, 0) and gamma is set to NULL. If gamma correction is needed it has to be initialized by gp_pixmap_gamma_set() or gp_pixmap_srgb_set().
It's possible to allocate a pixmap with zero w and h and in that case the gp_pixmap::pixels pointer will be set to NULL. Such pixmap must be resized with gp_pixmap_resize() to non-zero w and h in order to actually draw any pixels.
The content of gp_pixmap::pixels buffer is undefined.
The pixmap has to be freed with gp_pixmap_free() when no longer needed.
| w | A pixmap width. |
| h | A pixmap height. |
| type | A pixel type. |
| stride | The length in bytes of an image buffer row. Must be larger or equal than pixel size in bytes multiplied by width. It's determinted automatically when 0 is passed. |
errno is set.| EINVAL | Invalid pixel type or stride. |
| ENOMEM | Memory allocation failure. |
| EOVERFLOW | One of the multiplications did overflow when pixel buffer size was calculated. |
Referenced by gp_pixmap_alloc().
| int gp_pixmap_correction_set | ( | gp_pixmap * | self, |
| gp_correction_desc * | corr_desc ) |
Sets a correction for the pixmap.
If there was a gamma correction allready set for the pixmap the original correction reference counters are decremented and the correction is replaced with a new table.
| self | A pixmap. |
| corr_desc | A correction description. |
Referenced by gp_pixmap_gamma_set(), and gp_pixmap_srgb_set().
| void gp_pixmap_free | ( | gp_pixmap * | self | ) |
Frees a pixmap.
If pixmap->free_pixels is set also free pixel data, this flag is set automatically by gp_pixmap_alloc() and gp_pixmap_alloc_ex().
| self | A pixmap to free. |
|
inlinestatic |
Creates a pixmap from a buffer allocated by malloc().
This is actually shorthand for allocating the gp_pixmap structure and calling gp_pixmap_init() on the resulting pointer.
| w | Pixmap width |
| h | Pixmap height |
| type | A pixel type, describes how pixels are organized in the data buffer. |
| pixels | A pointer to a buffer with the pixel data. |
| flags | A bitmask or of the enum gp_pixmap_init_flags |
Definition at line 346 of file gp_pixmap.h.
References gp_pixmap_init().
|
inlinestatic |
Sets a gamma correction for the pixmap.
This is a shorthand for:
| self | A pixmap. |
| gamma | A gamma value. |
Definition at line 224 of file gp_pixmap.h.
References GP_CORRECTION_TYPE_GAMMA, and gp_pixmap_correction_set().
|
inlinestatic |
Sets a sRGB correction for the pixmap.
This is a shorthand for:
| self | A pixmap. |
Definition at line 251 of file gp_pixmap.h.
References GP_CORRECTION_TYPE_SRGB, and gp_pixmap_correction_set().