app: add a "layer-mode" property to GimpOperationLayerMode
This commit is contained in:
@ -157,6 +157,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
|
|||||||
*/
|
*/
|
||||||
gegl_node_set (node,
|
gegl_node_set (node,
|
||||||
"operation", gimp_layer_mode_get_operation (mode),
|
"operation", gimp_layer_mode_get_operation (mode),
|
||||||
|
"layer-mode", mode,
|
||||||
"opacity", opacity,
|
"opacity", opacity,
|
||||||
"linear", gimp_layer_mode_is_linear (mode),
|
"linear", gimp_layer_mode_is_linear (mode),
|
||||||
"blend-trc", gimp_layer_mode_get_blend_space (mode),
|
"blend-trc", gimp_layer_mode_get_blend_space (mode),
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_LAYER_MODE,
|
||||||
PROP_LINEAR,
|
PROP_LINEAR,
|
||||||
PROP_OPACITY,
|
PROP_OPACITY,
|
||||||
PROP_BLEND_TRC,
|
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->prepare = gimp_operation_layer_mode_prepare;
|
||||||
operation_class->process = gimp_operation_layer_mode_process;
|
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_object_class_install_property (object_class, PROP_LINEAR,
|
||||||
g_param_spec_boolean ("linear",
|
g_param_spec_boolean ("linear",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
@ -149,6 +158,10 @@ gimp_operation_layer_mode_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
|
case PROP_LAYER_MODE:
|
||||||
|
self->layer_mode = g_value_get_enum (value);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_LINEAR:
|
case PROP_LINEAR:
|
||||||
self->linear = g_value_get_boolean (value);
|
self->linear = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
@ -185,6 +198,10 @@ gimp_operation_layer_mode_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
|
case PROP_LAYER_MODE:
|
||||||
|
g_value_set_enum (value, self->layer_mode);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_LINEAR:
|
case PROP_LINEAR:
|
||||||
g_value_set_boolean (value, self->linear);
|
g_value_set_boolean (value, self->linear);
|
||||||
break;
|
break;
|
||||||
|
@ -44,6 +44,7 @@ struct _GimpOperationLayerMode
|
|||||||
{
|
{
|
||||||
GeglOperationPointComposer3 parent_instance;
|
GeglOperationPointComposer3 parent_instance;
|
||||||
|
|
||||||
|
GimpLayerMode layer_mode;
|
||||||
gboolean linear;
|
gboolean linear;
|
||||||
gdouble opacity;
|
gdouble opacity;
|
||||||
GimpLayerColorSpace blend_trc;
|
GimpLayerColorSpace blend_trc;
|
||||||
|
@ -305,6 +305,7 @@ do_layer_blend (GeglBuffer *src_buffer,
|
|||||||
GeglBufferIterator *iter;
|
GeglBufferIterator *iter;
|
||||||
guint paint_stride;
|
guint paint_stride;
|
||||||
gfloat *paint_data;
|
gfloat *paint_data;
|
||||||
|
gboolean linear;
|
||||||
GimpLayerModeFunc apply_func;
|
GimpLayerModeFunc apply_func;
|
||||||
GimpLayerColorSpace blend_trc;
|
GimpLayerColorSpace blend_trc;
|
||||||
GimpLayerColorSpace composite_trc;
|
GimpLayerColorSpace composite_trc;
|
||||||
@ -313,12 +314,13 @@ do_layer_blend (GeglBuffer *src_buffer,
|
|||||||
paint_stride = gimp_temp_buf_get_width (paint_buf);
|
paint_stride = gimp_temp_buf_get_width (paint_buf);
|
||||||
paint_data = (gfloat *) gimp_temp_buf_get_data (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);
|
apply_func = gimp_get_layer_mode_function (paint_mode);
|
||||||
blend_trc = gimp_layer_mode_get_blend_space (paint_mode);
|
blend_trc = gimp_layer_mode_get_blend_space (paint_mode);
|
||||||
composite_trc = gimp_layer_mode_get_composite_space (paint_mode);
|
composite_trc = gimp_layer_mode_get_composite_space (paint_mode);
|
||||||
composite_mode = gimp_layer_mode_get_composite_mode (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");
|
iterator_format = babl_format ("RGBA float");
|
||||||
else
|
else
|
||||||
iterator_format = babl_format ("R'G'B'A float");
|
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;
|
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.opacity = opacity;
|
||||||
layer_data.blend_trc = blend_trc;
|
layer_data.blend_trc = blend_trc;
|
||||||
layer_data.composite_trc = composite_trc;
|
layer_data.composite_trc = composite_trc;
|
||||||
|
Reference in New Issue
Block a user