Commit bf49b476 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 795207 - Add color space to blend(gradient) tool options

First WIP commit, adds:

- enum GimpGradientBlendColorSpace { RGB_PERCEPTUAL, RGB_LINEAR }
- linear blending mode for gradient segments
- tool options GUI for the blend and paint tools which use gradients
parent 3cb7fc86
......@@ -539,6 +539,7 @@ gradient_editor_split_midpoint_cmd_callback (GtkAction *action,
data_editor->context,
editor->control_sel_l,
editor->control_sel_r,
editor->blend_color_space,
&editor->control_sel_l,
&editor->control_sel_r);
}
......@@ -911,6 +912,7 @@ gradient_editor_split_uniform_response (GtkWidget *widget,
editor->control_sel_l,
editor->control_sel_r,
editor->split_parts,
editor->blend_color_space,
&editor->control_sel_l,
&editor->control_sel_r);
}
......
......@@ -98,6 +98,9 @@ G_DEFINE_TYPE_WITH_CODE (GimpGradient, gimp_gradient, GIMP_TYPE_DATA,
#define parent_class gimp_gradient_parent_class
static const Babl *fish_srgb_to_linear_rgb = NULL;
static const Babl *fish_linear_rgb_to_srgb = NULL;
static void
gimp_gradient_class_init (GimpGradientClass *klass)
......@@ -120,6 +123,11 @@ gimp_gradient_class_init (GimpGradientClass *klass)
data_class->get_extension = gimp_gradient_get_extension;
data_class->copy = gimp_gradient_copy;
data_class->compare = gimp_gradient_compare;
fish_srgb_to_linear_rgb = babl_fish (babl_format ("R'G'B' double"),
babl_format ("RGB double"));
fish_linear_rgb_to_srgb = babl_fish (babl_format ("RGBA double"),
babl_format ("R'G'B'A double"));
}
static void
......@@ -219,7 +227,9 @@ gimp_gradient_get_new_preview (GimpViewable *viewable,
for (x = 0; x < width; x++)
{
seg = gimp_gradient_get_color_at (gradient, context, seg, cur_x,
FALSE, &color);
FALSE,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
&color);
*p++ = ROUND (color.r * 255.0);
*p++ = ROUND (color.g * 255.0);
......@@ -413,12 +423,13 @@ gimp_gradient_get_extension (GimpData *data)
/**
* gimp_gradient_get_color_at:
* @gradient: a gradient
* @context: a context
* @seg: a segment to seed the search with (or %NULL)
* @pos: position in the gradient (between 0.0 and 1.0)
* @reverse: when %TRUE, use the reversed gradient
* @color: returns the color
* @gradient: a gradient
* @context: a context
* @seg: a segment to seed the search with (or %NULL)
* @pos: position in the gradient (between 0.0 and 1.0)
* @reverse: when %TRUE, use the reversed gradient
* @blend_color_space: color space to use for blending RGB segments
* @color: returns the color
*
* If you are iterating over an gradient, you should pass the the
* return value from the last call for @seg.
......@@ -426,12 +437,13 @@ gimp_gradient_get_extension (GimpData *data)
* Return value: the gradient segment the color is from
**/
GimpGradientSegment *
gimp_gradient_get_color_at (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *seg,
gdouble pos,
gboolean reverse,
GimpRGB *color)
gimp_gradient_get_color_at (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *seg,
gdouble pos,
gboolean reverse,
GimpGradientBlendColorSpace blend_color_space,
GimpRGB *color)
{
gdouble factor = 0.0;
gdouble seg_len;
......@@ -502,9 +514,23 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
if (seg->color == GIMP_GRADIENT_SEGMENT_RGB)
{
if (blend_color_space == GIMP_GRADIENT_BLEND_RGB_LINEAR)
{
babl_process (fish_srgb_to_linear_rgb,
&left_color, &left_color, 1);
babl_process (fish_srgb_to_linear_rgb,
&right_color, &right_color, 1);
}
rgb.r = left_color.r + (right_color.r - left_color.r) * factor;
rgb.g = left_color.g + (right_color.g - left_color.g) * factor;
rgb.b = left_color.b + (right_color.b - left_color.b) * factor;
if (blend_color_space == GIMP_GRADIENT_BLEND_RGB_LINEAR)
{
babl_process (fish_linear_rgb_to_srgb,
&rgb, &rgb, 1);
}
}
else
{
......@@ -590,12 +616,13 @@ gimp_gradient_has_fg_bg_segments (GimpGradient *gradient)
}
void
gimp_gradient_split_at (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *seg,
gdouble pos,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
gimp_gradient_split_at (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *seg,
gdouble pos,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
{
GimpRGB color;
GimpGradientSegment *newseg;
......@@ -610,7 +637,7 @@ gimp_gradient_split_at (GimpGradient *gradient,
/* Get color at pos */
gimp_gradient_get_color_at (gradient, context, seg, pos,
FALSE, &color);
FALSE, blend_color_space, &color);
/* Create a new segment and insert it in the list */
......@@ -779,11 +806,12 @@ gimp_gradient_segment_get_nth (GimpGradientSegment *seg,
}
void
gimp_gradient_segment_split_midpoint (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
gimp_gradient_segment_split_midpoint (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
{
g_return_if_fail (GIMP_IS_GRADIENT (gradient));
g_return_if_fail (GIMP_IS_CONTEXT (context));
......@@ -791,16 +819,18 @@ gimp_gradient_segment_split_midpoint (GimpGradient *gradient,
g_return_if_fail (newl != NULL);
g_return_if_fail (newr != NULL);
gimp_gradient_split_at (gradient, context, lseg, lseg->middle, newl, newr);
gimp_gradient_split_at (gradient, context, lseg, lseg->middle,
blend_color_space, newl, newr);
}
void
gimp_gradient_segment_split_uniform (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
gint parts,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
gimp_gradient_segment_split_uniform (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
gint parts,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr)
{
GimpGradientSegment *seg, *prev, *tmp;
gdouble seg_len;
......@@ -835,9 +865,11 @@ gimp_gradient_segment_split_uniform (GimpGradient *gradient,
seg->right_color_type = GIMP_GRADIENT_COLOR_FIXED;
gimp_gradient_get_color_at (gradient, context, lseg,
seg->left, FALSE, &seg->left_color);
seg->left, FALSE, blend_color_space,
&seg->left_color);
gimp_gradient_get_color_at (gradient, context, lseg,
seg->right, FALSE, &seg->right_color);
seg->right, FALSE, blend_color_space,
&seg->right_color);
seg->type = lseg->type;
seg->color = lseg->color;
......@@ -1626,12 +1658,13 @@ gimp_gradient_segment_range_replicate (GimpGradient *gradient,
}
void
gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg)
gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg)
{
GimpGradientSegment *seg, *lseg, *rseg;
......@@ -1648,7 +1681,8 @@ gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
do
{
gimp_gradient_segment_split_midpoint (gradient, context,
seg, &lseg, &rseg);
seg, blend_color_space,
&lseg, &rseg);
seg = rseg->next;
}
while (lseg != end_seg);
......@@ -1663,13 +1697,14 @@ gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
}
void
gimp_gradient_segment_range_split_uniform (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
gint parts,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg)
gimp_gradient_segment_range_split_uniform (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
gint parts,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg)
{
GimpGradientSegment *seg, *aseg, *lseg, *rseg, *lsel;
......@@ -1696,7 +1731,7 @@ gimp_gradient_segment_range_split_uniform (GimpGradient *gradient,
aseg = seg;
gimp_gradient_segment_split_uniform (gradient, context, seg,
parts,
parts, blend_color_space,
&lseg, &rseg);
if (seg == start_seg)
......
......@@ -76,6 +76,7 @@ GimpGradientSegment * gimp_gradient_get_color_at (GimpGradient *gradien
GimpGradientSegment *seg,
gdouble pos,
gboolean reverse,
GimpGradientBlendColorSpace blend_color_space,
GimpRGB *color);
GimpGradientSegment * gimp_gradient_get_segment_at (GimpGradient *grad,
gdouble pos);
......@@ -83,6 +84,7 @@ void gimp_gradient_split_at (GimpGradient *gradie
GimpContext *context,
GimpGradientSegment *seg,
gdouble pos,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr);
......@@ -105,12 +107,14 @@ void gimp_gradient_segments_free (GimpGradientSegment *seg)
void gimp_gradient_segment_split_midpoint (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr);
void gimp_gradient_segment_split_uniform (GimpGradient *gradient,
GimpContext *context,
GimpGradientSegment *lseg,
gint parts,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **newl,
GimpGradientSegment **newr);
......@@ -247,6 +251,7 @@ void gimp_gradient_segment_range_split_midpoint
GimpContext *context,
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg);
......@@ -256,6 +261,7 @@ void gimp_gradient_segment_range_split_uniform
GimpGradientSegment *start_seg,
GimpGradientSegment *end_seg,
gint parts,
GimpGradientBlendColorSpace blend_color_space,
GimpGradientSegment **final_start_seg,
GimpGradientSegment **final_end_seg);
......
......@@ -53,6 +53,7 @@ enum
PROP_GRADIENT_REPEAT,
PROP_OFFSET,
PROP_GRADIENT_REVERSE,
PROP_GRADIENT_BLEND_COLOR_SPACE,
PROP_SUPERSAMPLE,
PROP_SUPERSAMPLE_DEPTH,
PROP_SUPERSAMPLE_THRESHOLD,
......@@ -61,24 +62,25 @@ enum
typedef struct
{
GimpGradient *gradient;
gboolean reverse;
GimpGradient *gradient;
gboolean reverse;
GimpGradientBlendColorSpace blend_color_space;
#ifdef USE_GRADIENT_CACHE
GimpRGB *gradient_cache;
gint gradient_cache_size;
GimpRGB *gradient_cache;
gint gradient_cache_size;
#else
GimpGradientSegment *last_seg;
GimpGradientSegment *last_seg;
#endif
gdouble offset;
gdouble sx, sy;
GimpGradientType gradient_type;
gdouble dist;
gdouble vec[2];
GimpRepeatMode repeat;
GimpRGB leftmost_color;
GimpRGB rightmost_color;
GRand *seed;
GeglBuffer *dist_buffer;
gdouble offset;
gdouble sx, sy;
GimpGradientType gradient_type;
gdouble dist;
gdouble vec[2];
GimpRepeatMode repeat;
GimpRGB leftmost_color;
GimpRGB rightmost_color;
GRand *seed;
GeglBuffer *dist_buffer;
} RenderBlendData;
......@@ -281,6 +283,15 @@ gimp_operation_blend_class_init (GimpOperationBlendClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_GRADIENT_BLEND_COLOR_SPACE,
g_param_spec_enum ("gradient-blend-color-space",
"Blend Color Space",
"Which color space to use when blending RGB gradient segments",
GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_SUPERSAMPLE,
g_param_spec_boolean ("supersample",
"Supersample",
......@@ -380,6 +391,10 @@ gimp_operation_blend_get_property (GObject *object,
g_value_set_boolean (value, self->gradient_reverse);
break;
case PROP_GRADIENT_BLEND_COLOR_SPACE:
g_value_set_enum (value, self->gradient_blend_color_space);
break;
case PROP_SUPERSAMPLE:
g_value_set_boolean (value, self->supersample);
break;
......@@ -423,11 +438,7 @@ gimp_operation_blend_set_property (GObject *object,
{
GimpGradient *gradient = g_value_get_object (value);
if (self->gradient)
{
g_object_unref (self->gradient);
self->gradient = NULL;
}
g_clear_object (&self->gradient);
if (gradient)
{
......@@ -471,6 +482,10 @@ gimp_operation_blend_set_property (GObject *object,
self->gradient_reverse = g_value_get_boolean (value);
break;
case PROP_GRADIENT_BLEND_COLOR_SPACE:
self->gradient_blend_color_space = g_value_get_enum (value);
break;
case PROP_SUPERSAMPLE:
self->supersample = g_value_get_boolean (value);
break;
......@@ -928,7 +943,9 @@ gradient_render_pixel (gdouble x,
#else
rbd->last_seg = gimp_gradient_get_color_at (rbd->gradient, NULL,
rbd->last_seg, factor,
rbd->reverse, color);
rbd->reverse,
rbd->blend_color_space,
color);
#endif
}
}
......@@ -993,8 +1010,9 @@ gimp_operation_blend_process (GeglOperation *operation,
RenderBlendData rbd = { 0, };
rbd.gradient = NULL;
rbd.reverse = self->gradient_reverse;
rbd.gradient = NULL;
rbd.reverse = self->gradient_reverse;
rbd.blend_color_space = self->gradient_blend_color_space;
if (self->gradient)
rbd.gradient = g_object_ref (self->gradient);
......@@ -1014,7 +1032,9 @@ gimp_operation_blend_process (GeglOperation *operation,
gdouble factor = (gdouble) i / (gdouble) (rbd.gradient_cache_size - 1);
last_seg = gimp_gradient_get_color_at (rbd.gradient, NULL, last_seg,
factor, rbd.reverse,
factor,
rbd.reverse,
rbd.blend_color_space,
rbd.gradient_cache + i);
}
}
......
......@@ -38,22 +38,23 @@ typedef struct _GimpOperationBlendClass GimpOperationBlendClass;
struct _GimpOperationBlend
{
GeglOperationFilter parent_instance;
GeglOperationFilter parent_instance;
GimpContext *context;
GimpContext *context;
GimpGradient *gradient;
gdouble start_x, start_y, end_x, end_y;
GimpGradientType gradient_type;
GimpRepeatMode gradient_repeat;
gdouble offset;
gboolean gradient_reverse;
GimpGradient *gradient;
gdouble start_x, start_y, end_x, end_y;
GimpGradientType gradient_type;
GimpRepeatMode gradient_repeat;
gdouble offset;
gboolean gradient_reverse;
GimpGradientBlendColorSpace gradient_blend_color_space;
gboolean supersample;
gint supersample_depth;
gdouble supersample_threshold;
gboolean supersample;
gint supersample_depth;
gdouble supersample_threshold;
gboolean dither;
gboolean dither;
};
struct _GimpOperationBlendClass
......
......@@ -68,6 +68,7 @@
#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
#define DEFAULT_GRADIENT_REVERSE FALSE
#define DEFAULT_GRADIENT_BLEND_SPACE GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL
#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
#define DEFAULT_GRADIENT_LENGTH 100.0
#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
......@@ -115,6 +116,7 @@ enum
PROP_FADE_UNIT,
PROP_GRADIENT_REVERSE,
PROP_GRADIENT_BLEND_COLOR_SPACE,
PROP_BRUSH_VIEW_TYPE,
PROP_BRUSH_VIEW_SIZE,
......@@ -335,6 +337,13 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
NULL, NULL,
DEFAULT_GRADIENT_REVERSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_GRADIENT_BLEND_COLOR_SPACE,
"gradient-blend-color-space",
_("Blend Color Space"),
_("Which color space to use when blending RGB gradient segments"),
GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
DEFAULT_GRADIENT_BLEND_SPACE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_BRUSH_VIEW_TYPE,
"brush-view-type",
......@@ -576,6 +585,9 @@ gimp_paint_options_set_property (GObject *object,
case PROP_GRADIENT_REVERSE:
gradient_options->gradient_reverse = g_value_get_boolean (value);
break;
case PROP_GRADIENT_BLEND_COLOR_SPACE:
gradient_options->gradient_blend_color_space = g_value_get_enum (value);
break;
case PROP_BRUSH_VIEW_TYPE:
options->brush_view_type = g_value_get_enum (value);
......@@ -736,6 +748,9 @@ gimp_paint_options_get_property (GObject *object,
case PROP_GRADIENT_REVERSE:
g_value_set_boolean (value, gradient_options->gradient_reverse);
break;
case PROP_GRADIENT_BLEND_COLOR_SPACE:
g_value_set_enum (value, gradient_options->gradient_blend_color_space);
break;
case PROP_BRUSH_VIEW_TYPE:
g_value_set_enum (value, options->brush_view_type);
......@@ -951,6 +966,7 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
gimp_gradient_get_color_at (gradient, GIMP_CONTEXT (paint_options),
NULL, grad_point,
gradient_options->gradient_reverse,
gradient_options->gradient_blend_color_space,
color);
return TRUE;
......@@ -1192,16 +1208,19 @@ void
gimp_paint_options_copy_gradient_props (GimpPaintOptions *src,
GimpPaintOptions *dest)
{
gboolean gradient_reverse;
gboolean gradient_reverse;
GimpGradientBlendColorSpace gradient_blend_color_space;
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (src));
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (dest));
g_object_get (src,
"gradient-reverse", &gradient_reverse,
"gradient-reverse", &gradient_reverse,
"gradient-blend-color-space", &gradient_blend_color_space,
NULL);
g_object_set (dest,
"gradient-reverse", gradient_reverse,
"gradient-reverse", gradient_reverse,
"gradient-blend-color-space", gradient_blend_color_space,
NULL);
}
......@@ -52,8 +52,9 @@ struct _GimpFadeOptions
struct _GimpGradientOptions
{
gboolean gradient_reverse;
GimpRepeatMode gradient_repeat;
gboolean gradient_reverse;
GimpGradientBlendColorSpace gradient_blend_color_space;
GimpRepeatMode gradient_repeat;
};
struct _GimpSmoothingOptions
......
......@@ -335,7 +335,9 @@ gradient_get_uniform_samples_invoker (GimpProcedure *procedure,
if (success)
{
GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name,
GIMP_PDB_DATA_ACCESS_READ,
error);
if (gradient)
{
......@@ -353,7 +355,9 @@ gradient_get_uniform_samples_invoker (GimpProcedure *procedure,
GimpRGB color;
seg = gimp_gradient_get_color_at (gradient, context, seg,
pos, reverse, &color);
pos, reverse,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
&color);
*sample++ = color.r;
*sample++ = color.g;
......@@ -403,7 +407,9 @@ gradient_get_custom_samples_invoker (GimpProcedure *procedure,
if (success)
{
GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name,
GIMP_PDB_DATA_ACCESS_READ,
error);
if (gradient)
{
......@@ -420,7 +426,9 @@ gradient_get_custom_samples_invoker (GimpProcedure *procedure,
seg = gimp_gradient_get_color_at (gradient, context,
seg, *positions,
reverse, &color);
reverse,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
&color);
*sample++ = color.r;
*sample++ = color.g;
......@@ -469,7 +477,8 @@ gradient_segment_get_left_color_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -516,7 +525,8 @@ gradient_segment_set_left_color_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
&seg, error);
if (seg)
{
......@@ -554,7 +564,8 @@ gradient_segment_get_right_color_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -601,7 +612,8 @@ gradient_segment_set_right_color_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
&seg, error);
if (seg)
{
......@@ -638,7 +650,8 @@ gradient_segment_get_left_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -681,7 +694,8 @@ gradient_segment_set_left_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
&seg, error);
if (seg)
{
......@@ -722,7 +736,8 @@ gradient_segment_get_middle_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -765,7 +780,8 @@ gradient_segment_set_middle_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
&seg, error);
if (seg)
{
......@@ -807,7 +823,8 @@ gradient_segment_get_right_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -850,7 +867,8 @@ gradient_segment_set_right_pos_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
&seg, error);
if (seg)
{
......@@ -892,7 +910,8 @@ gradient_segment_get_blending_function_invoker (GimpProcedure *procedure
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -933,7 +952,8 @@ gradient_segment_get_coloring_type_invoker (GimpProcedure *procedure,
GimpGradient *gradient;
GimpGradientSegment *seg;
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment, &seg, error);
gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
&seg, error);
if (seg)
{
......@@ -1149,6 +1169,7 @@ gradient_segment_range_split_midpoint_invoker (GimpProcedure *procedure,
{
gimp_gradient_segment_range_split_midpoint (gradient, context,
start_seg, end_seg,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
NULL, NULL);
}
else
......@@ -1192,6 +1213,7 @@ gradient_segment_range_split_uniform_invoker (GimpProcedure *procedure,
gimp_gradient_segment_range_split_uniform (gradient, context,
start_seg, end_seg,
split_parts,
GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
NULL, NULL);
}
else
......
......@@ -127,7 +127,9 @@ gradients_sample_uniform_invoker (GimpProcedure *procedure,
while (num_samples--)
{
seg = gimp_gradient_get_color_at (gradient, context, seg,
pos, reverse, &color);
pos, reverse,