![]() |
![]() |
Gwyddion Drawing Library Reference Manual | ![]() |
|
---|---|---|---|---|
GwyPalette; 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);
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.
typedef struct _GwyPalette GwyPalette;
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.
typedef struct { GObjectClass parent_class; GHashTable *palettes; } GwyPaletteClass;
GwyPaletteClass
is deprecated and should not be used in newly-written code.
GObject* gwy_palette_new (GwyPaletteDef *palette_def);
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. |
void gwy_palette_set_palette_def (GwyPalette *palette, GwyPaletteDef *palette_def);
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. |
GwyPaletteDef* gwy_palette_get_palette_def (GwyPalette *palette);
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. |
gboolean gwy_palette_set_by_name (GwyPalette *palette, const gchar *name);
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.
|
guchar* gwy_palette_get_samples (GwyPalette *palette, gint *n_of_samples);
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. |
GwyRGBA* gwy_palette_get_data (GwyPalette *palette, gint *n_of_data);
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. |
guchar* gwy_palette_sample (GwyPalette *palette, gint size, guchar *oldsample);
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. |
void gwy_palette_print (GwyPalette *palette);
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 |