Navigation C API Pages Python bindings Applications

Basic types

Coordinates and Size and Length

Most of the drawing functions use typedefed GP_Coord and GP_Size integer types for parameters.

The GP_Coord is signed integer which is used for coordinates and the GP_Size is unsigned integer type used for object size, length and so.

Pixel

Pixel value in GFXprim is an integer big enough to hold the actual pixel values. The default typedef for GP_Pixel is set to 32 bit integer, which may be changed at compile time to support colors with more than 10 bits per channel. The GP_Pixel is thus used as opaque value big enough to hold any supported pixel value.

Color

The GP_Color enumeration holds symbolic constants for basic colors.

A GP_Color can be converted into a GP_Pixel for a given GP_PixelType. Symbolic values can also be converted to/from strings (color name in English).

The GP_Color enum is defined as follows:

typedef enum GP_Color {
        GP_COL_INVALID = -1,

        /* full-intensity RGB and CMYK */
        GP_COL_BLACK,
        GP_COL_RED,
        GP_COL_GREEN,
        GP_COL_BLUE,
        GP_COL_YELLOW,
        GP_COL_CYAN,
        GP_COL_MAGENTA,

        /* various common mixes */
        GP_COL_BROWN,
        GP_COL_ORANGE,
        GP_COL_GRAY_DARK,       /* exactly half RGB values of white */
        GP_COL_GRAY_LIGHT,
        GP_COL_PURPLE,

        GP_COL_WHITE,           /* full-intensity white */
        GP_COL_MAX,
} GP_Color;
#include <core/GP_Color.h>
/* or */
#include <GP.h>

GP_Pixel GP_ColorToPixel(GP_Color color, GP_PixelType pixel_type);
GP_Pixel GP_ColorToContextPixel(GP_Color color, GP_Context *context);

GP_Color GP_ColorNameToColor(const char *color_name);
const char *GP_ColorToColorName(GP_Color color);

bool GP_ColorNameToPixel(const char *color_name, GP_PixelType pixel_type,
                         GP_Pixel *pixel);
bool GP_ColorNameToContextPixel(const char *color_name, GP_Context *context,
                                GP_Pixel *pixel);

Functions for conversion between colors, pixels and color names. The last two returns true if color with such name was found.

#include <core/GP_Color.h>
/* or */
#include <GP.h>

void GP_ColorLoadPixels(GP_Pixel pixels[], GP_PixelType pixel_type);
void GP_ColorLoadContextPixels(GP_Pixel pixels[], GP_Context *context);

Loads array of GP_Pixel of size GP_COL_MAX, the array is then used with the GP_Color enum as pixels[GP_COL_BLACK].