9#ifndef GP_GET_PUT_PIXEL_GEN_H
10#define GP_GET_PUT_PIXEL_GEN_H
86#define GP_PIXEL_ADDR_1BPP_DB(pixmap, x, y) \
87 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
88 (1 * ((pixmap)->offset + x)) / 8))
96#define GP_PIXEL_ADDR_SHIFT_1BPP_DB(pixmap, x) \
97 (((x + (pixmap)->offset) % 8) * 1)
102#define GP_PIXEL_ADDR_OFFSET_1BPP_DB(pixmap, x) \
103 (((pixmap)->offset + x) % 8)
164#define GP_PIXEL_ADDR_1BPP_UB(pixmap, x, y) \
165 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
166 (1 * ((pixmap)->offset + x)) / 8))
174#define GP_PIXEL_ADDR_SHIFT_1BPP_UB(pixmap, x) \
175 (7 - ((x + (pixmap)->offset) % 8) * 1)
180#define GP_PIXEL_ADDR_OFFSET_1BPP_UB(pixmap, x) \
181 (((pixmap)->offset + x) % 8)
242#define GP_PIXEL_ADDR_2BPP_DB(pixmap, x, y) \
243 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
244 (2 * ((pixmap)->offset + x)) / 8))
252#define GP_PIXEL_ADDR_SHIFT_2BPP_DB(pixmap, x) \
253 (((x + (pixmap)->offset) % 4) * 2)
258#define GP_PIXEL_ADDR_OFFSET_2BPP_DB(pixmap, x) \
259 (((pixmap)->offset + x) % 4)
320#define GP_PIXEL_ADDR_2BPP_UB(pixmap, x, y) \
321 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
322 (2 * ((pixmap)->offset + x)) / 8))
330#define GP_PIXEL_ADDR_SHIFT_2BPP_UB(pixmap, x) \
331 (6 - ((x + (pixmap)->offset) % 4) * 2)
336#define GP_PIXEL_ADDR_OFFSET_2BPP_UB(pixmap, x) \
337 (((pixmap)->offset + x) % 4)
398#define GP_PIXEL_ADDR_4BPP_DB(pixmap, x, y) \
399 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
400 (4 * ((pixmap)->offset + x)) / 8))
408#define GP_PIXEL_ADDR_SHIFT_4BPP_DB(pixmap, x) \
409 (((x + (pixmap)->offset) % 2) * 4)
414#define GP_PIXEL_ADDR_OFFSET_4BPP_DB(pixmap, x) \
415 (((pixmap)->offset + x) % 2)
476#define GP_PIXEL_ADDR_4BPP_UB(pixmap, x, y) \
477 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
478 (4 * ((pixmap)->offset + x)) / 8))
486#define GP_PIXEL_ADDR_SHIFT_4BPP_UB(pixmap, x) \
487 (4 - ((x + (pixmap)->offset) % 2) * 4)
492#define GP_PIXEL_ADDR_OFFSET_4BPP_UB(pixmap, x) \
493 (((pixmap)->offset + x) % 2)
554#define GP_PIXEL_ADDR_8BPP(pixmap, x, y) \
555 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
564#define GP_PIXEL_ADDR_SHIFT_8BPP(pixmap, x) \
570#define GP_PIXEL_ADDR_OFFSET_8BPP(pixmap, x) \
626#define GP_PIXEL_ADDR_16BPP(pixmap, x, y) \
627 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
636#define GP_PIXEL_ADDR_SHIFT_16BPP(pixmap, x) \
642#define GP_PIXEL_ADDR_OFFSET_16BPP(pixmap, x) \
698#define GP_PIXEL_ADDR_24BPP(pixmap, x, y) \
699 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
708#define GP_PIXEL_ADDR_SHIFT_24BPP(pixmap, x) \
714#define GP_PIXEL_ADDR_OFFSET_24BPP(pixmap, x) \
788#define GP_PIXEL_ADDR_32BPP(pixmap, x, y) \
789 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
798#define GP_PIXEL_ADDR_SHIFT_32BPP(pixmap, x) \
804#define GP_PIXEL_ADDR_OFFSET_32BPP(pixmap, x) \
860#define GP_PIXEL_ADDR_18BPP_DB(pixmap, x, y) \
861 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
862 (18 * ((pixmap)->offset + x)) / 8))
870#define GP_PIXEL_ADDR_SHIFT_18BPP_DB(pixmap, x) \
871 ((18 * (x + (pixmap)->offset)) % 8)
876#define GP_PIXEL_ADDR_OFFSET_18BPP_DB(pixmap, x) \
uint32_t gp_pixel
Pixel integer value.
int gp_coord
Integer type for coordinates i.e. x, y, ...
static void gp_putpixel_raw_18BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 18BPP_DB
static gp_pixel gp_getpixel_raw_24BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 24BPP
static void gp_putpixel_raw_1BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 1BPP_DB
#define GP_PIXEL_ADDR_SHIFT_4BPP_DB(pixmap, x)
A macro to get bit-shift of pixel in 4BPP_DB pixmap.
static void gp_putpixel_raw_1BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 1BPP_UB
static gp_pixel gp_getpixel_raw_1BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 1BPP_DB
static void gp_putpixel_raw_16BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 16BPP
static void gp_putpixel_raw_24BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 24BPP
#define GP_PIXEL_ADDR_SHIFT_2BPP_DB(pixmap, x)
A macro to get bit-shift of pixel in 2BPP_DB pixmap.
static gp_pixel gp_getpixel_raw_1BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 1BPP_UB
static void gp_putpixel_raw_4BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 4BPP_DB
#define GP_PIXEL_ADDR_SHIFT_1BPP_DB(pixmap, x)
A macro to get bit-shift of pixel in 1BPP_DB pixmap.
static void gp_putpixel_raw_32BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 32BPP
static gp_pixel gp_getpixel_raw_2BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 2BPP_UB
static gp_pixel gp_getpixel_raw_18BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 18BPP_DB
static void gp_putpixel_raw_4BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 4BPP_UB
static gp_pixel gp_getpixel_raw_8BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 8BPP
static gp_pixel gp_getpixel_raw_4BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 4BPP_DB
static void gp_putpixel_raw_2BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 2BPP_DB
#define GP_PIXEL_ADDR_1BPP_UB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 1BPP_UB pixmap.
static gp_pixel gp_getpixel_raw_32BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 32BPP
#define GP_PIXEL_ADDR_18BPP_DB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 18BPP_DB pixmap.
#define GP_PIXEL_ADDR_2BPP_UB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 2BPP_UB pixmap.
static void gp_putpixel_raw_8BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 8BPP
static void gp_putpixel_raw_2BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 2BPP_UB
static gp_pixel gp_getpixel_raw_4BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 4BPP_UB
#define GP_PIXEL_ADDR_SHIFT_4BPP_UB(pixmap, x)
A macro to get bit-shift of pixel in 4BPP_UB pixmap.
#define GP_PIXEL_ADDR_4BPP_DB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 4BPP_DB pixmap.
#define GP_PIXEL_ADDR_24BPP(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 24BPP pixmap.
#define GP_PIXEL_ADDR_4BPP_UB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 4BPP_UB pixmap.
#define GP_PIXEL_ADDR_SHIFT_24BPP(pixmap, x)
A macro to get bit-shift of pixel in 24BPP pixmap.
static gp_pixel gp_getpixel_raw_2BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 2BPP_DB
#define GP_PIXEL_ADDR_1BPP_DB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 1BPP_DB pixmap.
#define GP_PIXEL_ADDR_8BPP(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 8BPP pixmap.
#define GP_PIXEL_ADDR_32BPP(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 32BPP pixmap.
static gp_pixel gp_getpixel_raw_16BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 16BPP
#define GP_PIXEL_ADDR_SHIFT_1BPP_UB(pixmap, x)
A macro to get bit-shift of pixel in 1BPP_UB pixmap.
#define GP_PIXEL_ADDR_SHIFT_2BPP_UB(pixmap, x)
A macro to get bit-shift of pixel in 2BPP_UB pixmap.
#define GP_PIXEL_ADDR_SHIFT_18BPP_DB(pixmap, x)
A macro to get bit-shift of pixel in 18BPP_DB pixmap.
#define GP_PIXEL_ADDR_2BPP_DB(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 2BPP_DB pixmap.
#define GP_PIXEL_ADDR_16BPP(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 16BPP pixmap.
Helper macros to get and set bits given offset and length.
#define GP_GET_BITS1_ALIGNED(offset, len, buf)
Align-safe get bits.
#define GP_SET_BITS1_ALIGNED(offset, len, dest, val)
Align-safe set bits.
#define GP_SET_BITS3_ALIGNED(offset, len, dest, val)
Align-safe set bits.
#define GP_GET_BITS3_ALIGNED(offset, len, buf)
Align-safe get bits.
#define GP_PIXEL_IS_CLIPPED(pixmap, x, y)
Returns true when pixel is clipped out of pixmap.