Commit 2ad9f40d authored by Ell's avatar Ell

app: add "custom" gradient

An internal gradient object, that will be used by the blend tool
when editing a gradient.  By default, the active gradient will not
be edited directly, but rather, upon editing, the active gradient's
contents will be copied to the custom gradient, which will then
become the active gradient and be edited.  This allows editing both
writable and nonwritable gradients without modifying them, and
without having to duplicate them.
parent f36f234f
......@@ -35,6 +35,7 @@
#include "gimp-intl.h"
#define CUSTOM_KEY "gimp-gradient-custom"
#define FG_BG_RGB_KEY "gimp-gradient-fg-bg-rgb"
#define FG_BG_HARDEDGE_KEY "gimp-gradient-fg-bg-rgb-hardedge"
#define FG_BG_HSV_CCW_KEY "gimp-gradient-fg-bg-hsv-ccw"
......@@ -58,6 +59,16 @@ gimp_gradients_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
/* Custom */
gradient = gimp_gradients_add_gradient (gimp,
_("Custom"),
CUSTOM_KEY);
g_object_set (gradient,
"writable", TRUE,
NULL);
gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND;
gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND;
/* FG to BG (RGB) */
gradient = gimp_gradients_add_gradient (gimp,
_("FG to BG (RGB)"),
......@@ -107,6 +118,14 @@ gimp_gradients_init (Gimp *gimp)
gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_FOREGROUND_TRANSPARENT;
}
GimpGradient *
gimp_gradients_get_custom (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
return g_object_get_data (G_OBJECT (gimp), CUSTOM_KEY);
}
GimpGradient *
gimp_gradients_get_fg_bg_rgb (Gimp *gimp)
{
......
......@@ -24,6 +24,7 @@
void gimp_gradients_init (Gimp *gimp);
GimpGradient * gimp_gradients_get_custom (Gimp *gimp);
GimpGradient * gimp_gradients_get_fg_bg_rgb (Gimp *gimp);
GimpGradient * gimp_gradients_get_fg_bg_hsv_ccw (Gimp *gimp);
GimpGradient * gimp_gradients_get_fg_bg_hsv_cw (Gimp *gimp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment