1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* gimpoperationreplacemode.c
5
* Copyright (C) 2008 Michael Natterer <mitch@gimp.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
#include <gegl-plugin.h>
26
#include "gimp-gegl-types.h"
28
#include "gimpoperationreplacemode.h"
31
static gboolean gimp_operation_replace_mode_process (GeglOperation *operation,
36
const GeglRectangle *roi,
40
G_DEFINE_TYPE (GimpOperationReplaceMode, gimp_operation_replace_mode,
41
GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
45
gimp_operation_replace_mode_class_init (GimpOperationReplaceModeClass *klass)
47
GeglOperationClass *operation_class;
48
GeglOperationPointComposerClass *point_class;
50
operation_class = GEGL_OPERATION_CLASS (klass);
51
point_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
53
gegl_operation_class_set_keys (operation_class,
54
"name" , "gimp:replace-mode",
55
"description", "GIMP replace mode operation",
58
point_class->process = gimp_operation_replace_mode_process;
62
gimp_operation_replace_mode_init (GimpOperationReplaceMode *self)
67
gimp_operation_replace_mode_process (GeglOperation *operation,
72
const GeglRectangle *roi,
76
gfloat *layer = aux_buf;
77
gfloat *out = out_buf;
82
out[GREEN] = in[GREEN];
84
out[ALPHA] = in[ALPHA];