mirror of https://github.com/GNOME/gimp.git
operations: Port semi-flatten to GeglColor
After the color space invasion, the Semi-Flatten GUI was broken since it still used GimpRGB as its color property. This patch fixes this by porting to GeglColor. The GimpRGB conversion was also removed from the PDB interface since the GeglColor comes directly from GimpContext.
This commit is contained in:
parent
29cac9eaef
commit
0c26cd442a
|
@ -73,7 +73,7 @@ gimp_operation_semi_flatten_class_init (GimpOperationSemiFlattenClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
GimpRGB white;
|
||||
GeglColor *color;
|
||||
|
||||
object_class->set_property = gimp_operation_semi_flatten_set_property;
|
||||
object_class->get_property = gimp_operation_semi_flatten_get_property;
|
||||
|
@ -88,13 +88,13 @@ gimp_operation_semi_flatten_class_init (GimpOperationSemiFlattenClass *klass)
|
|||
|
||||
point_class->process = gimp_operation_semi_flatten_process;
|
||||
|
||||
gimp_rgba_set (&white, 1.0, 1.0, 1.0, 1.0);
|
||||
color = gegl_color_new ("white");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_COLOR,
|
||||
gimp_param_spec_rgb ("color",
|
||||
gegl_param_spec_color ("color",
|
||||
_("Color"),
|
||||
_("The color"),
|
||||
FALSE, &white,
|
||||
/*FALSE,*/ color,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ gimp_operation_semi_flatten_get_property (GObject *object,
|
|||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
gimp_value_set_rgb (value, &self->color);
|
||||
g_value_set_object (value, self->color);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -135,7 +135,7 @@ gimp_operation_semi_flatten_set_property (GObject *object,
|
|||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
gimp_value_get_rgb (value, &self->color);
|
||||
g_set_object (&self->color, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -177,9 +177,14 @@ gimp_operation_semi_flatten_process (GeglOperation *operation,
|
|||
}
|
||||
else
|
||||
{
|
||||
dest[RED] = src[RED] * alpha + self->color.r * (1.0 - alpha);
|
||||
dest[GREEN] = src[GREEN] * alpha + self->color.g * (1.0 - alpha);
|
||||
dest[BLUE] = src[BLUE] * alpha + self->color.b * (1.0 - alpha);
|
||||
gdouble rgba[4];
|
||||
|
||||
gegl_color_get_rgba_with_space (self->color, &rgba[0], &rgba[1],
|
||||
&rgba[2], &rgba[3], NULL);
|
||||
|
||||
dest[RED] = src[RED] * alpha + rgba[0] * (1.0 - alpha);
|
||||
dest[GREEN] = src[GREEN] * alpha + rgba[1] * (1.0 - alpha);
|
||||
dest[BLUE] = src[BLUE] * alpha + rgba[2] * (1.0 - alpha);
|
||||
dest[ALPHA] = 1.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ struct _GimpOperationSemiFlatten
|
|||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpRGB color;
|
||||
GeglColor *color;
|
||||
};
|
||||
|
||||
struct _GimpOperationSemiFlattenClass
|
||||
|
|
|
@ -3947,15 +3947,13 @@ plug_in_semiflatten_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
GeglNode *node;
|
||||
GeglColor *color;
|
||||
GimpRGB rgb;
|
||||
|
||||
color = gimp_context_get_background (context);
|
||||
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
|
||||
|
||||
node =
|
||||
gegl_node_new_child (NULL,
|
||||
"operation", "gimp:semi-flatten",
|
||||
"color", &rgb,
|
||||
"color", color,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
|
|
|
@ -2090,10 +2090,10 @@ sub plug_in_laplace {
|
|||
|
||||
$help = <<'HELP';
|
||||
This plug-in creates one-pixel wide edges from the
|
||||
image, with the value proportional to the gradient.
|
||||
It uses the Laplace operator (a 3x3 kernel with -8
|
||||
in the middle). The image has to be laplacered to
|
||||
get useful results, a gauss_iir with 1.5 - 5.0
|
||||
image, with the value proportional to the gradient.
|
||||
It uses the Laplace operator (a 3x3 kernel with -8
|
||||
in the middle). The image has to be laplacered to
|
||||
get useful results, a gauss_iir with 1.5 - 5.0
|
||||
depending on the noise in the image is best.
|
||||
HELP
|
||||
|
||||
|
@ -2195,7 +2195,7 @@ HELP
|
|||
g_object_unref (color);
|
||||
|
||||
node = wrap_in_selection_bounds (node, drawable);
|
||||
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "Lens Distortion"),
|
||||
node);
|
||||
|
@ -2424,7 +2424,7 @@ sub plug_in_mblur_inward {
|
|||
$blurb = 'Simulate movement using directional blur';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is equivalent to plug-in-mblur but
|
||||
This procedure is equivalent to plug-in-mblur but
|
||||
performs the zoom blur inward instead of outward.
|
||||
HELP
|
||||
|
||||
|
@ -4058,15 +4058,13 @@ HELP
|
|||
{
|
||||
GeglNode *node;
|
||||
GeglColor *color;
|
||||
GimpRGB rgb;
|
||||
|
||||
color = gimp_context_get_background (context);
|
||||
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
|
||||
|
||||
node =
|
||||
gegl_node_new_child (NULL,
|
||||
"operation", "gimp:semi-flatten",
|
||||
"color", &rgb,
|
||||
"color", color,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
|
|
Loading…
Reference in New Issue