![]() | ![]() | ![]() | Gwyddion Drawing Library Reference Manual | ![]() |
---|
GwyPalette —
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);
GObject +----GwyPalette
GwyPalette implements GwySerializable and GwyWatchable.
GObject* gwy_palette_new (GwyPaletteDef *palette_def);
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. |
void gwy_palette_set_palette_def (GwyPalette *palette, GwyPaletteDef *palette_def);
Sets the palette definition to palette_def.
palette: | palette we want to be set. |
palette_def: | palette definition to be used. |
GwyPaletteDef* gwy_palette_get_palette_def (GwyPalette *palette);
Returns the palette definition this palette was created from.
palette: | A GwyPalette. |
Returns : | The palette definition. |
gboolean gwy_palette_set_by_name (GwyPalette *palette, const gchar *name);
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. |
guchar* gwy_palette_get_samples (GwyPalette *palette, gint *n_of_samples);
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. |
GwyRGBA* gwy_palette_get_data (GwyPalette *palette, gint *n_of_data);
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. |
guchar* gwy_palette_sample (GwyPalette *palette, gint size, guchar *oldsample);
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 field to be filled. |
Returns : | The sampled palette. |
void gwy_palette_print (GwyPalette *palette);
Debugging function that prints full palette color tables to stdout.
palette: | palette to be outputted |
<< Gwyddion Drawing Library | GwyPaletteDef >> |