Navigation C API Pages Python bindings Applications

GetPixel and PutPixel

#include <gfxprim.h>
/* or */
#include <core/GP_GetPutPixel.h>

gp_pixel gp_get_pixel(const gp_pixmap *pixmap, gp_coord x, gp_coord y);

void gp_put_pixel(gp_pixmap *pixmap, gp_coord x, gp_coord y, gp_pixel p);

Gets, puts a pixel value. gp_pixel is a number which holds a pixel value.

This functions are clipped, GetPixel outside of the pixmap returns zero, PutPixel outside the pixmap is no-op.

This functions honour pixmap rotation flags.

Generally these function are safe to use but rather slow in innner cycles.

#include <gfxprim.h>
/* or */
#include <core/GP_GetPutPixel.h>

gp_pixel gp_get_pixel_raw(const gp_pixmap *pixmap, gp_coord x, gp_coord y);

void gp_put_pixel_raw(gp_pixmap *pixmap, gp_coord x, gp_coord y, gp_pixel p);

/*
 * Substitute {{ bpp }} for specific bits per pixel (1BPP_LE, 24BPP, ...)
 *
 * These macros are generated to core/GP_GetPutPixel.gen.h
 */
gp_pixel gp_get_pixel_raw_{{ bpp }}(const gp_pixmap *c, int x, int y);

void gp_put_pixel_raw_{{ bpp }}(gp_pixmap *c, gp_coord x, gp_coord y,
                                gp_pixel p);

These functions are generally fast, but does not honour pixmap rotation flags and do not check that coordinates are inside of the pixmap.

They are intended as basic building blocks for other GFX primitives, filters, etc.