[gimp] app: add a "layer-mode" property to GimpOperationLayerMode
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add a "layer-mode" property to GimpOperationLayerMode
- Date: Sun, 22 Jan 2017 13:41:52 +0000 (UTC)
commit b10fc5880270ba42b850e25acc72beed449a462b
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 22 14:41:21 2017 +0100
app: add a "layer-mode" property to GimpOperationLayerMode
app/gegl/gimp-gegl-nodes.c | 1 +
.../layer-modes/gimpoperationlayermode.c | 17 +++++++++++++++++
.../layer-modes/gimpoperationlayermode.h | 1 +
app/paint/gimppaintcore-loops.c | 6 +++++-
4 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 1a65874..7def9ac 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -157,6 +157,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
*/
gegl_node_set (node,
"operation", gimp_layer_mode_get_operation (mode),
+ "layer-mode", mode,
"opacity", opacity,
"linear", gimp_layer_mode_is_linear (mode),
"blend-trc", gimp_layer_mode_get_blend_space (mode),
diff --git a/app/operations/layer-modes/gimpoperationlayermode.c
b/app/operations/layer-modes/gimpoperationlayermode.c
index 1f6e391..6900f79 100644
--- a/app/operations/layer-modes/gimpoperationlayermode.c
+++ b/app/operations/layer-modes/gimpoperationlayermode.c
@@ -35,6 +35,7 @@
enum
{
PROP_0,
+ PROP_LAYER_MODE,
PROP_LINEAR,
PROP_OPACITY,
PROP_BLEND_TRC,
@@ -86,6 +87,14 @@ gimp_operation_layer_mode_class_init (GimpOperationLayerModeClass *klass)
operation_class->prepare = gimp_operation_layer_mode_prepare;
operation_class->process = gimp_operation_layer_mode_process;
+ g_object_class_install_property (object_class, PROP_LAYER_MODE,
+ g_param_spec_enum ("layer-mode",
+ NULL, NULL,
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
g_object_class_install_property (object_class, PROP_LINEAR,
g_param_spec_boolean ("linear",
NULL, NULL,
@@ -149,6 +158,10 @@ gimp_operation_layer_mode_set_property (GObject *object,
switch (property_id)
{
+ case PROP_LAYER_MODE:
+ self->layer_mode = g_value_get_enum (value);
+ break;
+
case PROP_LINEAR:
self->linear = g_value_get_boolean (value);
break;
@@ -185,6 +198,10 @@ gimp_operation_layer_mode_get_property (GObject *object,
switch (property_id)
{
+ case PROP_LAYER_MODE:
+ g_value_set_enum (value, self->layer_mode);
+ break;
+
case PROP_LINEAR:
g_value_set_boolean (value, self->linear);
break;
diff --git a/app/operations/layer-modes/gimpoperationlayermode.h
b/app/operations/layer-modes/gimpoperationlayermode.h
index 4976529..56b44d3 100644
--- a/app/operations/layer-modes/gimpoperationlayermode.h
+++ b/app/operations/layer-modes/gimpoperationlayermode.h
@@ -44,6 +44,7 @@ struct _GimpOperationLayerMode
{
GeglOperationPointComposer3 parent_instance;
+ GimpLayerMode layer_mode;
gboolean linear;
gdouble opacity;
GimpLayerColorSpace blend_trc;
diff --git a/app/paint/gimppaintcore-loops.c b/app/paint/gimppaintcore-loops.c
index 8be68a5..9393db0 100644
--- a/app/paint/gimppaintcore-loops.c
+++ b/app/paint/gimppaintcore-loops.c
@@ -305,6 +305,7 @@ do_layer_blend (GeglBuffer *src_buffer,
GeglBufferIterator *iter;
guint paint_stride;
gfloat *paint_data;
+ gboolean linear;
GimpLayerModeFunc apply_func;
GimpLayerColorSpace blend_trc;
GimpLayerColorSpace composite_trc;
@@ -313,12 +314,13 @@ do_layer_blend (GeglBuffer *src_buffer,
paint_stride = gimp_temp_buf_get_width (paint_buf);
paint_data = (gfloat *) gimp_temp_buf_get_data (paint_buf);
+ linear = gimp_layer_mode_is_linear (paint_mode);
apply_func = gimp_get_layer_mode_function (paint_mode);
blend_trc = gimp_layer_mode_get_blend_space (paint_mode);
composite_trc = gimp_layer_mode_get_composite_space (paint_mode);
composite_mode = gimp_layer_mode_get_composite_mode (paint_mode);
- if (gimp_layer_mode_is_linear (paint_mode))
+ if (linear)
iterator_format = babl_format ("RGBA float");
else
iterator_format = babl_format ("R'G'B'A float");
@@ -361,6 +363,8 @@ do_layer_blend (GeglBuffer *src_buffer,
paint_pixel = paint_data + ((iter->roi[0].y - roi.y) * paint_stride + iter->roi[0].x - roi.x) * 4;
+ layer_data.layer_mode = paint_mode;
+ layer_data.linear = linear;
layer_data.opacity = opacity;
layer_data.blend_trc = blend_trc;
layer_data.composite_trc = composite_trc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]