GwyPalette

GwyPalette — Palettes mapping number ranges to colors

Synopsis




struct      GwyPalette;
struct      GwyPaletteClass;
GObject*    gwy_palette_new                 (GwyPaletteDef *palette_def);
void        gwy_palette_set_palette_def     (GwyPalette *palette,
                                             GwyPaletteDef *palette_def);
GwyPaletteDef* gwy_palette_get_palette_def  (GwyPalette *palette);
gboolean    gwy_palette_set_by_name         (GwyPalette *palette,
                                             const gchar *name);
guchar*     gwy_palette_get_samples         (GwyPalette *palette,
                                             gint *n_of_samples);
GwyRGBA*    gwy_palette_get_data            (GwyPalette *palette,
                                             gint *n_of_data);
guchar*     gwy_palette_sample              (GwyPalette *palette,
                                             gint size,
                                             guchar *oldsample);
void        gwy_palette_print               (GwyPalette *palette);

Object Hierarchy


  GObject
   +----GwyPalette

Implemented Interfaces

GwyPalette implements GwySerializable and GwyWatchable.

Description

This type is broken, deprecated, and will be removed in 2.0. Use GwyGradient for new stuff.

A palette is a map from interval [0,1] to RGB or RGBA space. Palettes as created from palette definitions that contain some defining points between them the colors are interpolated.

Details

struct GwyPalette

struct GwyPalette;

Warning

GwyPalette is deprecated and should not be used in newly-written code.

The GwyPalette struct contains private data only and should be accessed using the functions below.


struct GwyPaletteClass

struct GwyPaletteClass {

    GObjectClass parent_class;

    GHashTable *palettes;
};

Warning

GwyPaletteClass is deprecated and should not be used in newly-written code.


gwy_palette_new ()

GObject*    gwy_palette_new                 (GwyPaletteDef *palette_def);

Warning

gwy_palette_new is deprecated and should not be used in newly-written code.

Creates a new palette based on palette definition palette_def.

You can pass NULL as palette_def, a default gray palette will be returned then.

palette_def : A palette definition.
Returns : The palette, as a GObject.

gwy_palette_set_palette_def ()

void        gwy_palette_set_palette_def     (GwyPalette *palette,
                                             GwyPaletteDef *palette_def);

Warning

gwy_palette_set_palette_def is deprecated and should not be used in newly-written code.

Sets the palette definition to palette_def.

palette : palette we want to be set.
palette_def : palette definition to be used.

gwy_palette_get_palette_def ()

GwyPaletteDef* gwy_palette_get_palette_def  (GwyPalette *palette);

Warning

gwy_palette_get_palette_def is deprecated and should not be used in newly-written code.

Returns the palette definition this palette was created from.

palette : A GwyPalette.
Returns : The palette definition.

gwy_palette_set_by_name ()

gboolean    gwy_palette_set_by_name         (GwyPalette *palette,
                                             const gchar *name);

Warning

gwy_palette_set_by_name is deprecated and should not be used in newly-written code.

Defines palette using palette definition of given name.

palette : A GwyPalette.
name : A palette definition name.
Returns : TURE if palette definition of given name existed, FALSE on failure.

gwy_palette_get_samples ()

guchar*     gwy_palette_get_samples         (GwyPalette *palette,
                                             gint *n_of_samples);

Warning

gwy_palette_get_samples is deprecated and should not be used in newly-written code.

Returns palette sampled to integers in GdkPixbuf-like RRGGBBAA scheme.

The returned samples should be considered constant and not modified or freed.

The returned samples will automatically change when the palette definition changes.

palette : A palette the samples should be returned for.
n_of_samples : A location to store the number of samples.
Returns : The sampled palette.

gwy_palette_get_data ()

GwyRGBA*    gwy_palette_get_data            (GwyPalette *palette,
                                             gint *n_of_data);

Warning

gwy_palette_get_data is deprecated and should not be used in newly-written code.

Returns palette sampled to GwyRGBA.

The returned samples should be considered constant and not modified or freed.

palette : A palette the samples should be returned for.
n_of_data : A location to store the number of samples.
Returns : The sampled palette.

gwy_palette_sample ()

guchar*     gwy_palette_sample              (GwyPalette *palette,
                                             gint size,
                                             guchar *oldsample);

Warning

gwy_palette_sample is deprecated and should not be used in newly-written code.

Fills the GdkPixbuf-like field of RRGGBBAA integer values representing the palette.

If oldsample is not NULL, it's resized to 4*size bytes, otherwise it's newly allocated.

If you don't have a reason for specific sample size (and are not going to modify the samples or otherwise dislike the automatic resampling on palette definition change), use gwy_palette_get_samples() instead.

palette : palette to be sampled.
size : Required sample size.
oldsample : Pointer to array to be filled.
Returns : The sampled palette.

gwy_palette_print ()

void        gwy_palette_print               (GwyPalette *palette);

Warning

gwy_palette_print is deprecated and should not be used in newly-written code.

Debugging function that prints full palette color tables to stdout.

palette : palette to be outputted

See Also

GwyPaletteDef, GwyGradient.