Navigation C API Pages Python bindings Applications

Pixel Conversions

This page describes RGB tripplet to pixels conversions.

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

gp_pixel gp_rgb_to_pixel(uint8_t r, uint8_t g, uint8_t b, gp_pixel_type type);

gp_pixel gp_rgba_to_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
                          gp_pixel_type type);

gp_pixel gp_rgb_to_pixmap_pixel(uint8_t r, uint8_t g, uint8_t b,
                                const gp_pixmap *pixmap);

gp_pixel gp_rgba_to_pixmap_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
                                 const gp_pixmap *pixmap);

Simple functions to convert RGB or RGBA 8 bit values into the specific pixel types.

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

gp_pixel gp_convert_pixel(gp_pixel pixel, gp_pixel_type from, gp_pixel_type to);

Converts pixel value. The conversion currently converts by converting the value to RGBA8888 and then to the resulting value.