2012-03-16 19:49:34 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimp-gegl-nodes.h
|
|
|
|
* Copyright (C) 2012 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gegl.h>
|
|
|
|
|
|
|
|
#include "gimp-gegl-types.h"
|
|
|
|
|
|
|
|
#include "gimp-gegl-nodes.h"
|
|
|
|
#include "gimp-gegl-utils.h"
|
|
|
|
|
|
|
|
|
|
|
|
GeglNode *
|
|
|
|
gimp_gegl_create_flatten_node (const GimpRGB *background)
|
|
|
|
{
|
|
|
|
GeglNode *node;
|
|
|
|
GeglNode *input;
|
|
|
|
GeglNode *output;
|
|
|
|
GeglNode *color;
|
|
|
|
GeglNode *over;
|
|
|
|
GeglColor *c;
|
|
|
|
|
|
|
|
g_return_val_if_fail (background != NULL, NULL);
|
|
|
|
|
|
|
|
node = gegl_node_new ();
|
|
|
|
|
|
|
|
input = gegl_node_get_input_proxy (node, "input");
|
|
|
|
output = gegl_node_get_output_proxy (node, "output");
|
|
|
|
|
2012-03-20 17:27:28 +08:00
|
|
|
c = gimp_gegl_color_new (background);
|
2012-03-16 19:49:34 +08:00
|
|
|
color = gegl_node_new_child (node,
|
|
|
|
"operation", "gegl:color",
|
|
|
|
"value", c,
|
|
|
|
NULL);
|
|
|
|
g_object_unref (c);
|
|
|
|
|
|
|
|
over = gegl_node_new_child (node,
|
|
|
|
"operation", "gegl:over",
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gegl_node_connect_to (input, "output",
|
|
|
|
over, "aux");
|
|
|
|
gegl_node_connect_to (color, "output",
|
|
|
|
over, "input");
|
|
|
|
gegl_node_connect_to (over, "output",
|
|
|
|
output, "input");
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
2012-03-17 00:29:28 +08:00
|
|
|
|
|
|
|
GeglNode *
|
|
|
|
gimp_gegl_create_apply_opacity_node (GeglBuffer *mask,
|
2012-03-19 09:30:18 +08:00
|
|
|
gint mask_offset_x,
|
2012-03-24 22:22:49 +08:00
|
|
|
gint mask_offset_y,
|
|
|
|
gdouble opacity)
|
2012-03-17 00:29:28 +08:00
|
|
|
{
|
|
|
|
GeglNode *node;
|
|
|
|
GeglNode *input;
|
|
|
|
GeglNode *output;
|
|
|
|
GeglNode *opacity_node;
|
|
|
|
GeglNode *mask_source;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GEGL_IS_BUFFER (mask), NULL);
|
|
|
|
|
|
|
|
node = gegl_node_new ();
|
|
|
|
|
|
|
|
input = gegl_node_get_input_proxy (node, "input");
|
|
|
|
output = gegl_node_get_output_proxy (node, "output");
|
|
|
|
|
|
|
|
opacity_node = gegl_node_new_child (node,
|
|
|
|
"operation", "gegl:opacity",
|
|
|
|
"value", opacity,
|
|
|
|
NULL);
|
2012-03-24 21:54:36 +08:00
|
|
|
|
|
|
|
mask_source = gimp_gegl_add_buffer_source (node, mask,
|
2012-03-24 22:22:49 +08:00
|
|
|
mask_offset_x,
|
|
|
|
mask_offset_y);
|
2012-03-17 00:29:28 +08:00
|
|
|
|
|
|
|
gegl_node_connect_to (input, "output",
|
|
|
|
opacity_node, "input");
|
2012-03-24 21:54:36 +08:00
|
|
|
gegl_node_connect_to (mask_source, "output",
|
|
|
|
opacity_node, "aux");
|
|
|
|
gegl_node_connect_to (opacity_node, "output",
|
|
|
|
output, "input");
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
GeglNode *
|
|
|
|
gimp_gegl_add_buffer_source (GeglNode *parent,
|
|
|
|
GeglBuffer *buffer,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
|
|
|
{
|
|
|
|
GeglNode *buffer_source;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GEGL_IS_NODE (parent), NULL);
|
|
|
|
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
|
|
|
|
|
|
|
|
buffer_source = gegl_node_new_child (parent,
|
|
|
|
"operation", "gegl:buffer-source",
|
|
|
|
"buffer", buffer,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (offset_x != 0 || offset_y != 0)
|
|
|
|
{
|
|
|
|
GeglNode *translate =
|
|
|
|
gegl_node_new_child (parent,
|
|
|
|
"operation", "gegl:translate",
|
|
|
|
"x", (gdouble) offset_x,
|
|
|
|
"y", (gdouble) offset_y,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gegl_node_connect_to (buffer_source, "output",
|
|
|
|
translate, "input");
|
|
|
|
|
|
|
|
buffer_source = translate;
|
|
|
|
}
|
|
|
|
|
|
|
|
return buffer_source;
|
|
|
|
}
|
2012-03-25 01:28:05 +08:00
|
|
|
|
|
|
|
void
|
2017-01-09 06:00:19 +08:00
|
|
|
gimp_gegl_mode_node_set_mode (GeglNode *node,
|
|
|
|
GimpLayerMode mode,
|
|
|
|
gboolean linear)
|
2012-03-25 01:28:05 +08:00
|
|
|
{
|
2017-01-11 07:28:57 +08:00
|
|
|
const gchar *operation = "gimp:normal";
|
2013-06-13 04:13:01 +08:00
|
|
|
gdouble opacity;
|
2012-03-25 01:28:05 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GEGL_IS_NODE (node));
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
2017-01-09 06:00:19 +08:00
|
|
|
case GIMP_LAYER_MODE_NORMAL:
|
2017-01-11 07:28:57 +08:00
|
|
|
operation = "gimp:normal";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_DISSOLVE:
|
2017-01-10 16:06:16 +08:00
|
|
|
operation = "gimp:dissolve";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_BEHIND:
|
|
|
|
operation = "gimp:behind-mode";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
|
2017-01-11 07:12:45 +08:00
|
|
|
operation = "gimp:multiply-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 09:03:52 +08:00
|
|
|
case GIMP_LAYER_MODE_MULTIPLY:
|
|
|
|
case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
|
|
|
|
operation = "gimp:multiply";
|
|
|
|
break;
|
|
|
|
|
2017-01-10 06:19:29 +08:00
|
|
|
case GIMP_LAYER_MODE_SCREEN:
|
|
|
|
operation = "gimp:screen";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_SCREEN_LEGACY:
|
2017-01-10 06:19:29 +08:00
|
|
|
operation = "gimp:screen-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_OVERLAY_LEGACY:
|
2017-01-09 06:00:19 +08:00
|
|
|
operation = "gimp:softlight-mode";
|
|
|
|
break;
|
|
|
|
|
2017-01-10 06:44:57 +08:00
|
|
|
case GIMP_LAYER_MODE_DIFFERENCE:
|
|
|
|
operation = "gimp:difference";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
|
2017-01-10 06:44:57 +08:00
|
|
|
operation = "gimp:difference-legacyy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-10 08:37:26 +08:00
|
|
|
case GIMP_LAYER_MODE_ADDITION:
|
|
|
|
operation = "gimp:addition";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_ADDITION_LEGACY:
|
2017-01-10 08:37:26 +08:00
|
|
|
operation = "gimp:addition-legacy";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_SUBTRACT:
|
|
|
|
operation = "gimp:subtract";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
|
2017-01-10 08:37:26 +08:00
|
|
|
operation = "gimp:subtract-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-10 10:07:36 +08:00
|
|
|
case GIMP_LAYER_MODE_DARKEN_ONLY:
|
|
|
|
operation = "gimp:darken-only";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
|
2017-01-10 10:07:36 +08:00
|
|
|
operation = "gimp:darken-only-legacy";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_LIGHTEN_ONLY:
|
|
|
|
operation = "gimp:lighten-only";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
|
2017-01-10 10:07:36 +08:00
|
|
|
operation = "gimp:lighten-only-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-11 02:37:51 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_HUE:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-hue";
|
2017-01-11 02:37:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_HSV_SATURATION:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-saturation";
|
2017-01-11 02:37:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_HSV_COLOR:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-color";
|
2017-01-11 02:37:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_HSV_VALUE:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-value";
|
2017-01-11 02:37:51 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-hue-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-saturation-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-color-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
|
2017-01-11 06:46:01 +08:00
|
|
|
operation = "gimp:hsv-value-legacy";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_DIVIDE_LEGACY:
|
2017-01-11 07:10:09 +08:00
|
|
|
operation = "gimp:divide-mode";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 12:32:08 +08:00
|
|
|
case GIMP_LAYER_MODE_DODGE:
|
|
|
|
operation = "gimp:dodge";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_DODGE_LEGACY:
|
2017-01-09 12:32:08 +08:00
|
|
|
operation = "gimp:dodge-legacy";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_BURN_LEGACY:
|
2017-01-11 07:10:09 +08:00
|
|
|
operation = "gimp:burn-mode";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
|
2017-01-09 06:00:19 +08:00
|
|
|
operation = "gimp:hardlight-mode";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
|
2017-01-09 06:00:19 +08:00
|
|
|
operation = "gimp:softlight-mode";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
|
2017-01-09 06:00:19 +08:00
|
|
|
operation = "gimp:grain-extract-mode";
|
|
|
|
break;
|
|
|
|
|
2017-01-09 08:27:20 +08:00
|
|
|
case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
|
2017-01-09 06:00:19 +08:00
|
|
|
operation = "gimp:grain-merge-mode";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_COLOR_ERASE:
|
|
|
|
operation = "gimp:color-erase-mode";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_OVERLAY:
|
2017-01-10 06:50:42 +08:00
|
|
|
operation = "gimp:overlay";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_LCH_HUE:
|
2017-01-10 08:04:49 +08:00
|
|
|
operation = "gimp:lch-hue";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_LCH_CHROMA:
|
2017-01-10 08:04:49 +08:00
|
|
|
operation = "gimp:lch-chroma";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_LCH_COLOR:
|
2017-01-10 08:04:49 +08:00
|
|
|
operation = "gimp:lch-color";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_LCH_LIGHTNESS:
|
2017-01-10 08:04:49 +08:00
|
|
|
operation = "gimp:lch-lightness";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_ERASE:
|
2017-01-11 07:21:43 +08:00
|
|
|
operation = "gimp:erase";
|
2017-01-10 06:50:42 +08:00
|
|
|
break;
|
2017-01-09 06:00:19 +08:00
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_REPLACE:
|
|
|
|
operation = "gimp:replace-mode";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_LAYER_MODE_ANTI_ERASE:
|
2017-01-11 07:21:43 +08:00
|
|
|
operation = "gimp:anti-erase";
|
2017-01-09 06:00:19 +08:00
|
|
|
break;
|
2017-01-10 06:50:42 +08:00
|
|
|
|
2012-03-25 01:28:05 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-06-13 04:13:01 +08:00
|
|
|
gegl_node_get (node,
|
|
|
|
"opacity", &opacity,
|
|
|
|
NULL);
|
|
|
|
|
2013-10-19 23:31:32 +08:00
|
|
|
/* setting the operation creates a new instance, so we have to set
|
|
|
|
* all its properties
|
|
|
|
*/
|
2012-03-25 01:28:05 +08:00
|
|
|
gegl_node_set (node,
|
2012-12-14 05:58:38 +08:00
|
|
|
"operation", operation,
|
|
|
|
"linear", linear,
|
2013-06-13 04:13:01 +08:00
|
|
|
"opacity", opacity,
|
2012-03-25 01:28:05 +08:00
|
|
|
NULL);
|
2016-12-23 06:50:02 +08:00
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case GIMP_LAYER_MODE_NORMAL:
|
|
|
|
case GIMP_LAYER_MODE_DISSOLVE:
|
2017-01-09 09:03:52 +08:00
|
|
|
case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
|
|
|
|
gegl_node_set (node,
|
|
|
|
"linear", TRUE,
|
|
|
|
NULL);
|
|
|
|
break;
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_BEHIND:
|
2017-01-09 09:03:52 +08:00
|
|
|
case GIMP_LAYER_MODE_MULTIPLY:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
|
2017-01-10 06:19:29 +08:00
|
|
|
case GIMP_LAYER_MODE_SCREEN:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_SCREEN_LEGACY:
|
2017-01-10 08:37:26 +08:00
|
|
|
case GIMP_LAYER_MODE_ADDITION:
|
|
|
|
case GIMP_LAYER_MODE_SUBTRACT:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_ADDITION_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
|
2017-01-10 10:07:36 +08:00
|
|
|
case GIMP_LAYER_MODE_DARKEN_ONLY:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
|
2017-01-10 10:07:36 +08:00
|
|
|
case GIMP_LAYER_MODE_LIGHTEN_ONLY:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
|
|
|
|
case GIMP_LAYER_MODE_OVERLAY_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
|
2017-01-10 06:44:57 +08:00
|
|
|
case GIMP_LAYER_MODE_DIFFERENCE:
|
2017-01-11 02:37:51 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_HUE:
|
|
|
|
case GIMP_LAYER_MODE_HSV_SATURATION:
|
|
|
|
case GIMP_LAYER_MODE_HSV_COLOR:
|
|
|
|
case GIMP_LAYER_MODE_HSV_VALUE:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_DIVIDE_LEGACY:
|
2017-01-09 12:32:08 +08:00
|
|
|
case GIMP_LAYER_MODE_DODGE:
|
2016-12-23 06:50:02 +08:00
|
|
|
case GIMP_LAYER_MODE_DODGE_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_BURN_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
|
|
|
|
case GIMP_LAYER_MODE_COLOR_ERASE:
|
|
|
|
case GIMP_LAYER_MODE_OVERLAY:
|
|
|
|
case GIMP_LAYER_MODE_ERASE:
|
|
|
|
case GIMP_LAYER_MODE_REPLACE:
|
|
|
|
case GIMP_LAYER_MODE_ANTI_ERASE:
|
|
|
|
case GIMP_LAYER_MODE_LCH_HUE:
|
|
|
|
case GIMP_LAYER_MODE_LCH_CHROMA:
|
|
|
|
case GIMP_LAYER_MODE_LCH_COLOR:
|
|
|
|
case GIMP_LAYER_MODE_LCH_LIGHTNESS:
|
|
|
|
default:
|
|
|
|
gegl_node_set (node,
|
|
|
|
"linear", FALSE,
|
|
|
|
NULL);
|
|
|
|
break;
|
|
|
|
}
|
2012-03-25 01:28:05 +08:00
|
|
|
}
|
2012-03-31 22:18:13 +08:00
|
|
|
|
2013-04-27 14:23:58 +08:00
|
|
|
void
|
2013-04-23 04:53:07 +08:00
|
|
|
gimp_gegl_mode_node_set_opacity (GeglNode *node,
|
|
|
|
gdouble opacity)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GEGL_IS_NODE (node));
|
|
|
|
|
|
|
|
gegl_node_set (node,
|
|
|
|
"opacity", opacity,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2012-03-31 22:18:13 +08:00
|
|
|
void
|
|
|
|
gimp_gegl_node_set_matrix (GeglNode *node,
|
|
|
|
const GimpMatrix3 *matrix)
|
|
|
|
{
|
|
|
|
gchar *matrix_string;
|
|
|
|
|
|
|
|
g_return_if_fail (GEGL_IS_NODE (node));
|
|
|
|
g_return_if_fail (matrix != NULL);
|
|
|
|
|
|
|
|
matrix_string = gegl_matrix3_to_string ((GeglMatrix3 *) matrix);
|
|
|
|
|
|
|
|
gegl_node_set (node,
|
|
|
|
"transform", matrix_string,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_free (matrix_string);
|
|
|
|
}
|
2013-10-19 23:31:32 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_gegl_node_set_color (GeglNode *node,
|
|
|
|
const GimpRGB *color)
|
|
|
|
{
|
|
|
|
GeglColor *gegl_color;
|
|
|
|
|
|
|
|
g_return_if_fail (GEGL_IS_NODE (node));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
|
|
|
gegl_color = gimp_gegl_color_new (color);
|
|
|
|
|
|
|
|
gegl_node_set (node,
|
|
|
|
"value", gegl_color,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_object_unref (gegl_color);
|
|
|
|
}
|