GIMP Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# gimpgradients

## Name

gimpgradients --

## Synopsis

    gboolean    gimp_gradients_refresh          (void);
    gchar**     gimp_gradients_get_list         (gint *num_gradients);
    gchar*      gimp_gradients_get_gradient     (void);
    gboolean    gimp_gradients_set_gradient     (gchar *name);
    gdouble*    gimp_gradients_sample_uniform   (gint num_samples);
    gdouble*    gimp_gradients_sample_custom    (gint num_samples,
                                                 gdouble *positions);
    gchar*      gimp_gradients_get_gradient_data
                                                (gchar *name,
                                                 gint sample_size,
                                                 gint *width,
                                                 gdouble **grad_data);
    gboolean    gimp_gradients_popup            (gchar *gradient_callback,
                                                 gchar *popup_title,
                                                 gchar *initial_gradient,
                                                 gint sample_size);
    gboolean    gimp_gradients_close_popup      (gchar *gradient_callback);
    gboolean    gimp_gradients_set_popup        (gchar *gradient_callback,
                                                 gchar *gradient_name);

## Description

## Details

### gimp_gradients_refresh ()

    gboolean    gimp_gradients_refresh          (void);

Refresh current gradients.

This procedure retrieves all gradients currently in the user's gradient path and updates the gradient dialogs accordingly.

Returns : | TRUE on success.

### gimp_gradients_get_list ()

    gchar**     gimp_gradients_get_list         (gint *num_gradients);

Retrieve the list of loaded gradients.

This procedure returns a list of the gradients that are currently loaded in the gradient editor. You can later use the gimp_gradients_set_active function to set the active gradient.

`num_gradients` : | The number of loaded gradients.
Returns : | The list of gradient names.

### gimp_gradients_get_gradient ()

    gchar*      gimp_gradients_get_gradient     (void);

Retrieve the name of the active gradient.

This procedure returns the name of the active gradient in the gradient editor.

Returns : | The name of the active gradient.

### gimp_gradients_set_gradient ()

    gboolean    gimp_gradients_set_gradient     (gchar *name);

Sets the specified gradient as the active gradient.

This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients in the gradient editor. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.

`name` : | The name of the gradient to set.
Returns : | TRUE on success.

### gimp_gradients_sample_uniform ()

    gdouble*    gimp_gradients_sample_uniform   (gint num_samples);

Sample the active gradient in uniform parts.

This procedure samples the active gradient from the gradient editor in the specified number of uniform parts. It returns a list of floating-point values which correspond to the RGBA values for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the { 0.0, 1.0 } positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions { 0.0, 0.5, 1.0 }.

`num_samples` : | The number of samples to take.
Returns : | Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.

### gimp_gradients_sample_custom ()

    gdouble*    gimp_gradients_sample_custom    (gint num_samples,
                                                 gdouble *positions);

Sample the active gradient in custom positions.

This procedure samples the active gradient from the gradient editor in the specified number of points. The procedure will sample the gradient in the specified positions from the list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. The procedure returns a list of floating-point values which correspond to the RGBA values for each sample.

`num_samples` : | The number of samples to take.
`positions` : | The list of positions to sample along the gradient.
Returns : | Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.

### gimp_gradients_get_gradient_data ()

    gchar*      gimp_gradients_get_gradient_data
                                                (gchar *name,
                                                 gint sample_size,
                                                 gint *width,
                                                 gdouble **grad_data);

Retrieve information about the specified gradient (including data).

This procedure retrieves information about the gradient. This includes the gradient name, and the sample data for the gradient.

`name` : | The gradient name (\"\" means current active gradient).
`sample_size` : | Size of the sample to return when the gradient is changed.
`width` : | The gradient sample width (r,g,b,a).
`grad_data` : | The gradient sample data.
Returns : | The gradient name.

### gimp_gradients_popup ()

    gboolean    gimp_gradients_popup            (gchar *gradient_callback,
                                                 gchar *popup_title,
                                                 gchar *initial_gradient,
                                                 gint sample_size);

Invokes the Gimp gradients selection.

This procedure popups the gradients selection dialog.

`gradient_callback` : | The callback PDB proc to call when gradient selection is made.
`popup_title` : | Title to give the gradient popup window.
`initial_gradient` : | The name of the pattern to set as the first selected.
`sample_size` : | Size of the sample to return when the gradient is changed.
Returns : | TRUE on success.

### gimp_gradients_close_popup ()

    gboolean    gimp_gradients_close_popup      (gchar *gradient_callback);

Popdown the Gimp gradient selection.

This procedure closes an opened gradient selection dialog.

`gradient_callback` : | The name of the callback registered for this popup.
Returns : | TRUE on success.

### gimp_gradients_set_popup ()

    gboolean    gimp_gradients_set_popup        (gchar *gradient_callback,
                                                 gchar *gradient_name);

Sets the current gradient selection in a popup.

Sets the current gradient selection in a popup.

`gradient_callback` : | The name of the callback registered for this popup.
`gradient_name` : | The name of the gradient to set as selected.
Returns : | TRUE on success.

<<< Previous Page | Home | Up | Next Page >>>
gimpgimprc | gimpguides