GwyPaletteDef

GwyPaletteDef — Palette definitions

Synopsis




#define     GWY_PALETTE_BLUE
#define     GWY_PALETTE_BLUE_CYAN
#define     GWY_PALETTE_BLUE_VIOLET
#define     GWY_PALETTE_BLUE_YELLOW
#define     GWY_PALETTE_BW1
#define     GWY_PALETTE_BW2
#define     GWY_PALETTE_COLD
#define     GWY_PALETTE_DFIT
#define     GWY_PALETTE_GOLD
#define     GWY_PALETTE_GRAY
#define     GWY_PALETTE_GREEN
#define     GWY_PALETTE_GREEN_CYAN
#define     GWY_PALETTE_GREEN_VIOLET
#define     GWY_PALETTE_GREEN_YELLOW
#define     GWY_PALETTE_OLIVE
#define     GWY_PALETTE_PINK
#define     GWY_PALETTE_PM3D
#define     GWY_PALETTE_RAINBOW1
#define     GWY_PALETTE_RAINBOW2
#define     GWY_PALETTE_RED
#define     GWY_PALETTE_RED_CYAN
#define     GWY_PALETTE_RED_VIOLET
#define     GWY_PALETTE_RED_YELLOW
#define     GWY_PALETTE_SPECTRAL
#define     GWY_PALETTE_WARM
#define     GWY_PALETTE_YELLOW
struct      GwyPaletteDefEntry;
struct      GwyPaletteDef;
struct      GwyPaletteDefClass;
void        (*GwyPaletteDefFunc)            (const gchar *name,
                                             GwyPaletteDef *palette_def,
                                             gpointer user_data);
GObject*    gwy_palette_def_new             (const gchar *name);
GObject*    gwy_palette_def_new_as_copy     (GwyPaletteDef *src_palette_def);
gchar*      gwy_palette_def_get_name        (GwyPaletteDef *palette_def);
gboolean    gwy_palette_def_set_name        (GwyPaletteDef *palette_def,
                                             const gchar *name);
gboolean    gwy_palette_def_exists          (const gchar *name);
void        gwy_palette_def_foreach         (GwyPaletteDefFunc callback,
                                             gpointer user_data);
GwyRGBA     gwy_palette_def_get_color       (GwyPaletteDef *palette_def,
                                             gdouble x,
                                             GwyInterpolationType interpolation);
void        gwy_palette_def_set_color       (GwyPaletteDef *palette_def,
                                             GwyPaletteDefEntry *val);
void        gwy_palette_def_set_from_samples
                                            (GwyPaletteDef *palette_def,
                                             GwyRGBA *samples,
                                             gint nsamples,
                                             gint istep);
void        gwy_palette_def_setup_presets   (void);
GString*    gwy_palette_def_dump            (GwyPaletteDef *palette_def);
GwyPaletteDef* gwy_palette_def_parse        (const gchar *text,
                                             gboolean rename_on_clash);
#define     gwy_palette_def_is_set          (pd)

Object Hierarchy


  GObject
   +----GwyPaletteDef

Implemented Interfaces

GwyPaletteDef implements GwySerializable and GwyWatchable.

Description

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

A palette definition consists of defining points, between them the colors are interpolated to get a GwyPalette.

Details

GWY_PALETTE_BLUE

#define GWY_PALETTE_BLUE         "Blue"

Warning

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

A blue palette.


GWY_PALETTE_BLUE_CYAN

#define GWY_PALETTE_BLUE_CYAN    "Blue-Cyan"

Warning

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

A black-blue-cyan-white palette.


GWY_PALETTE_BLUE_VIOLET

#define GWY_PALETTE_BLUE_VIOLET  "Blue-Violet"

Warning

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

A black-blue-violet-white palette.


GWY_PALETTE_BLUE_YELLOW

#define GWY_PALETTE_BLUE_YELLOW  "Blue-Yellow"

Warning

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

A black-blue-yellow-white palette.


GWY_PALETTE_BW1

#define GWY_PALETTE_BW1          "BW1"

Warning

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

A striped black-and-white palette with blended stripes.


GWY_PALETTE_BW2

#define GWY_PALETTE_BW2          "BW2"

Warning

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

A striped black-and-white palette with sharp stripes.


GWY_PALETTE_COLD

#define GWY_PALETTE_COLD         "Cold"

Warning

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

A blue, cold palette.


GWY_PALETTE_DFIT

#define GWY_PALETTE_DFIT         "DFit"

Warning

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

A light black-violet-red-yellow-green-blue-white palette resembling a dendrofit palette.


GWY_PALETTE_GOLD

#define GWY_PALETTE_GOLD         "Gold"

Warning

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

A gold palette.


GWY_PALETTE_GRAY

#define GWY_PALETTE_GRAY         "Gray"

Warning

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

A gray palette.

This is the default palette.


GWY_PALETTE_GREEN

#define GWY_PALETTE_GREEN        "Green"

Warning

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

A green palette.


GWY_PALETTE_GREEN_CYAN

#define GWY_PALETTE_GREEN_CYAN   "Green-Cyan"

Warning

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

A black-green-cyan-white palette.


GWY_PALETTE_GREEN_VIOLET

#define GWY_PALETTE_GREEN_VIOLET "Green-Violet"

Warning

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

A black-green-violet-white palette.


GWY_PALETTE_GREEN_YELLOW

#define GWY_PALETTE_GREEN_YELLOW "Green-Yellow"

Warning

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

A black-green-yellow-white palette.


GWY_PALETTE_OLIVE

#define GWY_PALETTE_OLIVE        "Olive"

Warning

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

A plive palette.


GWY_PALETTE_PINK

#define GWY_PALETTE_PINK         "Pink"

Warning

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

A pink palette.


GWY_PALETTE_PM3D

#define GWY_PALETTE_PM3D         "Pm3d"

Warning

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

A black-blue-red-gold palette strongly resembling default pm3d palette.


GWY_PALETTE_RAINBOW1

#define GWY_PALETTE_RAINBOW1     "Rainbow1"

Warning

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

A colorful rainbow palette.


GWY_PALETTE_RAINBOW2

#define GWY_PALETTE_RAINBOW2     "Rainbow2"

Warning

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

A black-red-green-blue-white palette.


GWY_PALETTE_RED

#define GWY_PALETTE_RED          "Red"

Warning

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

A red palette.


GWY_PALETTE_RED_CYAN

#define GWY_PALETTE_RED_CYAN     "Red-Cyan"

Warning

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

A black-red-cyan-white palette.


GWY_PALETTE_RED_VIOLET

#define GWY_PALETTE_RED_VIOLET   "Red-Violet"

Warning

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

A black-red-violet-white palette.


GWY_PALETTE_RED_YELLOW

#define GWY_PALETTE_RED_YELLOW   "Red-Yellow"

Warning

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

A black-red-yellow-white palette.


GWY_PALETTE_SPECTRAL

#define GWY_PALETTE_SPECTRAL     "Spectral"

Warning

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

A palette resembling spectral colors (starting and ending with black).


GWY_PALETTE_WARM

#define GWY_PALETTE_WARM         "Warm"

Warning

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

A red-yellow, warm palette.


GWY_PALETTE_YELLOW

#define GWY_PALETTE_YELLOW       "Yellow"

Warning

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

A yellowish palette.


struct GwyPaletteDefEntry

struct GwyPaletteDefEntry {

    gdouble x;
    GwyRGBA color;
};

Warning

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

Palette definition entry type.

The x coordinate is from the range [0,1].

gdouble x Position of color in the palette definition.
GwyRGBA color The color at position x.

struct GwyPaletteDef

struct GwyPaletteDef;

Warning

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

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


struct GwyPaletteDefClass

struct GwyPaletteDefClass {

    GObjectClass parent_class;

    GHashTable *palettes;
};

Warning

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


GwyPaletteDefFunc ()

void        (*GwyPaletteDefFunc)            (const gchar *name,
                                             GwyPaletteDef *palette_def,
                                             gpointer user_data);

Warning

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

Callback function type for gwy_palette_def_foreach().

name : Palette definition name.
palette_def : Palette definition.
user_data : A user-specified pointer.

gwy_palette_def_new ()

GObject*    gwy_palette_def_new             (const gchar *name);

Warning

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

Returns a palette definition called name.

Palette definitions of the same name are singletons, thus if a palette definitions called name already exists, it is returned instead (with reference count incremented).

name can be NULL, a new unique name is invented then.

A newly created palette definition is completely empty.

name : Palette name.
Returns : The new palette definition as a GObject.

gwy_palette_def_new_as_copy ()

GObject*    gwy_palette_def_new_as_copy     (GwyPaletteDef *src_palette_def);

Warning

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

Creates a new palette definition as a copy of an existing one.

A new name is invented based on the existing one.

src_palette_def : An existing GwyPaletteDef.
Returns : The new palette definition as a GObject.

gwy_palette_def_get_name ()

gchar*      gwy_palette_def_get_name        (GwyPaletteDef *palette_def);

Warning

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

Returns the name of palette definition palette_def.

palette_def : A GwyPaletteDef.
Returns : The name. It should be considered constant and not modifier or freed.

gwy_palette_def_set_name ()

gboolean    gwy_palette_def_set_name        (GwyPaletteDef *palette_def,
                                             const gchar *name);

Warning

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

Sets the name of a palette definition.

This function fails when a palette definition of given name already exists.

palette_def : A GwyPaletteDef.
name : A new name of the palette definition.
Returns : Whether the rename was successfull.

gwy_palette_def_exists ()

gboolean    gwy_palette_def_exists          (const gchar *name);

Warning

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

Tests whether a palette definition of given name exists.

name : A palette definition name.
Returns : TRUE if such a palette definition exists, FALSE otherwise.

gwy_palette_def_foreach ()

void        gwy_palette_def_foreach         (GwyPaletteDefFunc callback,
                                             gpointer user_data);

Warning

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

Runs callback for each existing palette definition.

callback : A callback.
user_data : User data passed to the callback.

gwy_palette_def_get_color ()

GwyRGBA     gwy_palette_def_get_color       (GwyPaletteDef *palette_def,
                                             gdouble x,
                                             GwyInterpolationType interpolation);

Warning

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

Finds the color at position x between 0 and gwy_palette_def_get_n().

Interpolates between palette definition entries closest to x and returns the resulting color.

palette_def : palette definition of interest
x : position (0-N)
interpolation : interpolation method
Returns : the color sample.

gwy_palette_def_set_color ()

void        gwy_palette_def_set_color       (GwyPaletteDef *palette_def,
                                             GwyPaletteDefEntry *val);

Warning

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

Adds an entry to palette definition.

palette_def : A palette definition to be changed.
val : An entry to be added.

gwy_palette_def_set_from_samples ()

void        gwy_palette_def_set_from_samples
                                            (GwyPaletteDef *palette_def,
                                             GwyRGBA *samples,
                                             gint nsamples,
                                             gint istep);

Warning

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

Fits the palette definition to given color samples.

It finds the extrema points inside palette color tables and tries to setup the palette definition to fit the color tables. This fucntion should be used only when there is a reason for doing this, for example after some graphical entry of palette color table values. Parameter istep controls the precision of the linear fit.

However, the precise algorithm may change in the future.

palette_def : A GwyPaletteDef to be computed.
samples : Color data to ctreate the definition from.
nsamples : The number of samples in samples.
istep : Maximum distance of definition entries, 0 means unlimited.

gwy_palette_def_setup_presets ()

void        gwy_palette_def_setup_presets   (void);

Warning

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

Set up built-in palette definitions. To be used in Gwyddion initialization and eventually replaced by loading palette definitions from external files.


gwy_palette_def_dump ()

GString*    gwy_palette_def_dump            (GwyPaletteDef *palette_def);

Warning

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

Dumps a paletted definition to text.

palette_def : A palette definition.
Returns : A GString with palette text representation.

Since 1.4.


gwy_palette_def_parse ()

GwyPaletteDef* gwy_palette_def_parse        (const gchar *text,
                                             gboolean rename_on_clash);

Warning

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

Creates a palette defnition from a text dump.

text : A text palette definition dump, as created with gwy_palette_def_dump().
rename_on_clash : Whether the created palette should be renamed to an unique name instad of overwriting the existing one on a name clash.
Returns : The palette (NULL on failure).

Since 1.4.


gwy_palette_def_is_set()

#define gwy_palette_def_is_set(pd) (GWY_PALETTE_DEF(pd)->data->len)

Warning

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

Expands to TRUE if the palette definition contains any colors.

XXX: This is flawed. Unset palette definitions should not exist, though currently gwy_palette_def_new() creates them.

pd : A palette definition.

See Also

GwyPalette, GwyGradient.