9#ifndef GP_GET_PUT_PIXEL_GEN_H
10#define GP_GET_PUT_PIXEL_GEN_H
87#define GP_PIXEL_ADDR_1BPP_DB(pixmap, x, y) \
88 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
89 (1 * ((pixmap)->offset + x)) / 8))
97#define GP_PIXEL_ADDR_SHIFT_1BPP_DB(pixmap, x) \
98 (((x + (pixmap)->offset) % 8) * 1)
103#define GP_PIXEL_ADDR_OFFSET_1BPP_DB(pixmap, x) \
104 (((pixmap)->offset + x) % 8)
165#define GP_PIXEL_ADDR_1BPP_UB(pixmap, x, y) \
166 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
167 (1 * ((pixmap)->offset + x)) / 8))
175#define GP_PIXEL_ADDR_SHIFT_1BPP_UB(pixmap, x) \
176 (7 - ((x + (pixmap)->offset) % 8) * 1)
181#define GP_PIXEL_ADDR_OFFSET_1BPP_UB(pixmap, x) \
182 (((pixmap)->offset + x) % 8)
243#define GP_PIXEL_ADDR_2BPP_DB(pixmap, x, y) \
244 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
245 (2 * ((pixmap)->offset + x)) / 8))
253#define GP_PIXEL_ADDR_SHIFT_2BPP_DB(pixmap, x) \
254 (((x + (pixmap)->offset) % 4) * 2)
259#define GP_PIXEL_ADDR_OFFSET_2BPP_DB(pixmap, x) \
260 (((pixmap)->offset + x) % 4)
321#define GP_PIXEL_ADDR_2BPP_UB(pixmap, x, y) \
322 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
323 (2 * ((pixmap)->offset + x)) / 8))
331#define GP_PIXEL_ADDR_SHIFT_2BPP_UB(pixmap, x) \
332 (6 - ((x + (pixmap)->offset) % 4) * 2)
337#define GP_PIXEL_ADDR_OFFSET_2BPP_UB(pixmap, x) \
338 (((pixmap)->offset + x) % 4)
399#define GP_PIXEL_ADDR_4BPP_DB(pixmap, x, y) \
400 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
401 (4 * ((pixmap)->offset + x)) / 8))
409#define GP_PIXEL_ADDR_SHIFT_4BPP_DB(pixmap, x) \
410 (((x + (pixmap)->offset) % 2) * 4)
415#define GP_PIXEL_ADDR_OFFSET_4BPP_DB(pixmap, x) \
416 (((pixmap)->offset + x) % 2)
477#define GP_PIXEL_ADDR_4BPP_UB(pixmap, x, y) \
478 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
479 (4 * ((pixmap)->offset + x)) / 8))
487#define GP_PIXEL_ADDR_SHIFT_4BPP_UB(pixmap, x) \
488 (4 - ((x + (pixmap)->offset) % 2) * 4)
493#define GP_PIXEL_ADDR_OFFSET_4BPP_UB(pixmap, x) \
494 (((pixmap)->offset + x) % 2)
555#define GP_PIXEL_ADDR_8BPP(pixmap, x, y) \
556 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
565#define GP_PIXEL_ADDR_SHIFT_8BPP(pixmap, x) \
571#define GP_PIXEL_ADDR_OFFSET_8BPP(pixmap, x) \
627#define GP_PIXEL_ADDR_16BPP(pixmap, x, y) \
628 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
637#define GP_PIXEL_ADDR_SHIFT_16BPP(pixmap, x) \
643#define GP_PIXEL_ADDR_OFFSET_16BPP(pixmap, x) \
699#define GP_PIXEL_ADDR_16BPP_BE(pixmap, x, y) \
700 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
709#define GP_PIXEL_ADDR_SHIFT_16BPP_BE(pixmap, x) \
715#define GP_PIXEL_ADDR_OFFSET_16BPP_BE(pixmap, x) \
771#define GP_PIXEL_ADDR_24BPP(pixmap, x, y) \
772 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
781#define GP_PIXEL_ADDR_SHIFT_24BPP(pixmap, x) \
787#define GP_PIXEL_ADDR_OFFSET_24BPP(pixmap, x) \
861#define GP_PIXEL_ADDR_32BPP(pixmap, x, y) \
862 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
871#define GP_PIXEL_ADDR_SHIFT_32BPP(pixmap, x) \
877#define GP_PIXEL_ADDR_OFFSET_32BPP(pixmap, x) \
933#define GP_PIXEL_ADDR_18BPP_DB(pixmap, x, y) \
934 ((gp_pixel*)(((void*)((pixmap)->pixels)) + (pixmap)->bytes_per_row * (y) + \
935 (18 * ((pixmap)->offset + x)) / 8))
943#define GP_PIXEL_ADDR_SHIFT_18BPP_DB(pixmap, x) \
944 ((18 * (x + (pixmap)->offset)) % 8)
949#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.
static void gp_putpixel_raw_16BPP_BE(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 16BPP_BE
#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.
static gp_pixel gp_getpixel_raw_16BPP_BE(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 16BPP_BE
#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_BE(pixmap, x, y)
A macro to get address of a starting byte for a pixel in a 16BPP_BE 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(offset, len, buf)
Align-safe get bits.
#define GP_GET_BITS3_LE(offset, len, buf)
Little endian align-safe get bits.
#define GP_SET_BITS1(offset, len, dest, val)
Align-safe set bits.
#define GP_SET_BITS3_LE(offset, len, dest, val)
Little endian align-safe set bits.
Helper macros to get and set bytes.
#define GP_GET_BYTES1(src)
Align safe get byte.
#define GP_SET_BYTES2_LE(dst, bytes)
Little endian align usafe set bytes.
#define GP_SET_BYTES2_BE(dst, bytes)
Big endian align usafe set bytes.
#define GP_SET_BYTES4_LE(dst, bytes)
Little endian align usafe set bytes.
#define GP_GET_BYTES2_BE(src)
Big endian align usafe get bytes.
#define GP_SET_BYTES1(dst, byte)
Align safe set byte.
#define GP_GET_BYTES4_LE(src)
Little endian align usafe get bytes.
#define GP_GET_BYTES2_LE(src)
Little endian align usafe get bytes.
#define GP_PIXEL_IS_CLIPPED(pixmap, x, y)
Returns true when pixel is clipped out of pixmap.