app: move overlay to operations/layer-modes/ and call it GimpOperationOverlay

This commit is contained in:
Michael Natterer
2017-01-09 23:50:42 +01:00
parent b6be1b768e
commit b001626b31
8 changed files with 106 additions and 103 deletions

View File

@ -260,7 +260,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
break;
case GIMP_LAYER_MODE_OVERLAY:
operation = "gimp:overlay-mode";
operation = "gimp:overlay";
break;
case GIMP_LAYER_MODE_LCH_HUE:
@ -280,7 +280,8 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
break;
case GIMP_LAYER_MODE_ERASE:
operation = "gimp:erase-mode"; break;
operation = "gimp:erase-mode";
break;
case GIMP_LAYER_MODE_REPLACE:
operation = "gimp:replace-mode";
@ -289,6 +290,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
case GIMP_LAYER_MODE_ANTI_ERASE:
operation = "gimp:anti-erase-mode";
break;
default:
break;
}

View File

@ -101,8 +101,6 @@ libappoperations_a_SOURCES = \
gimpoperationdissolvemode.h \
gimpoperationbehindmode.c \
gimpoperationbehindmode.h \
gimpoperationoverlaymode.c \
gimpoperationoverlaymode.h \
gimpoperationadditionmode.c \
gimpoperationadditionmode.h \
gimpoperationsubtractmode.c \

View File

@ -73,7 +73,7 @@
#include "layer-modes-legacy/gimpoperationmultiplylegacy.h"
#include "layer-modes/gimpoperationscreen.h"
#include "layer-modes-legacy/gimpoperationscreenlegacy.h"
#include "gimpoperationoverlaymode.h"
#include "layer-modes/gimpoperationoverlay.h"
#include "gimpoperationdifferencemode.h"
#include "gimpoperationadditionmode.h"
#include "gimpoperationsubtractmode.h"
@ -139,7 +139,7 @@ gimp_operations_init (void)
g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY);
g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY_LEGACY);
g_type_class_ref (GIMP_TYPE_OPERATION_SCREEN_MODE);
g_type_class_ref (GIMP_TYPE_OPERATION_OVERLAY_MODE);
g_type_class_ref (GIMP_TYPE_OPERATION_OVERLAY);
g_type_class_ref (GIMP_TYPE_OPERATION_DIFFERENCE_MODE);
g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION_MODE);
g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT_MODE);

View File

@ -33,7 +33,7 @@
#include "layer-modes-legacy/gimpoperationmultiplylegacy.h"
#include "layer-modes/gimpoperationscreen.h"
#include "layer-modes-legacy/gimpoperationscreenlegacy.h"
#include "gimpoperationoverlaymode.h"
#include "layer-modes/gimpoperationoverlay.h"
#include "gimpoperationdifferencemode.h"
#include "gimpoperationadditionmode.h"
#include "gimpoperationsubtractmode.h"
@ -174,7 +174,7 @@ get_layer_mode_function (GimpLayerMode paint_mode,
break;
case GIMP_LAYER_MODE_OVERLAY:
func = gimp_operation_overlay_mode_process_pixels;
func = gimp_operation_overlay_process_pixels;
break;
case GIMP_LAYER_MODE_LCH_HUE:

View File

@ -1,61 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpoperationoverlaymode.h
* Copyright (C) 2008 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/>.
*/
#ifndef __GIMP_OPERATION_OVERLAY_MODE_H__
#define __GIMP_OPERATION_OVERLAY_MODE_H__
#include "gimpoperationpointlayermode.h"
#define GIMP_TYPE_OPERATION_OVERLAY_MODE (gimp_operation_overlay_mode_get_type ())
#define GIMP_OPERATION_OVERLAY_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_OVERLAY_MODE, GimpOperationOverlayMode))
#define GIMP_OPERATION_OVERLAY_MODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_OVERLAY_MODE, GimpOperationOverlayModeClass))
#define GIMP_IS_OPERATION_OVERLAY_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_OVERLAY_MODE))
#define GIMP_IS_OPERATION_OVERLAY_MODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_OVERLAY_MODE))
#define GIMP_OPERATION_OVERLAY_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_OVERLAY_MODE, GimpOperationOverlayModeClass))
typedef struct _GimpOperationOverlayMode GimpOperationOverlayMode;
typedef struct _GimpOperationOverlayModeClass GimpOperationOverlayModeClass;
struct _GimpOperationOverlayMode
{
GimpOperationPointLayerMode parent_instance;
};
struct _GimpOperationOverlayModeClass
{
GimpOperationPointLayerModeClass parent_class;
};
GType gimp_operation_overlay_mode_get_type (void) G_GNUC_CONST;
gboolean gimp_operation_overlay_mode_process_pixels (gfloat *in,
gfloat *layer,
gfloat *mask,
gfloat *out,
gfloat opacity,
glong samples,
const GeglRectangle *roi,
gint level);
#endif /* __GIMP_OPERATION_OVERLAY_MODE_H__ */

View File

@ -23,7 +23,9 @@ libapplayermodes_generic_a_sources = \
gimpoperationdodge.c \
gimpoperationdodge.h \
gimpoperationmultiply.c \
gimpoperationmultiply.h \
gimpoperationmultiply.h \
gimpoperationoverlay.c \
gimpoperationoverlay.h \
gimpoperationscreen.c \
gimpoperationscreen.h \
gimpoperationdifference.c \

View File

@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpoperationoverlaymode.c
* gimpoperationoverlay.c
* Copyright (C) 2008 Michael Natterer <mitch@gimp.org>
* 2012 Ville Sokk <ville.sokk@gmail.com>
*
@ -23,27 +23,27 @@
#include <gegl-plugin.h>
#include "operations-types.h"
#include "../operations-types.h"
#include "gimpoperationoverlaymode.h"
#include "gimpoperationoverlay.h"
static gboolean gimp_operation_overlay_mode_process (GeglOperation *operation,
void *in_buf,
void *aux_buf,
void *aux2_buf,
void *out_buf,
glong samples,
const GeglRectangle *roi,
gint level);
static gboolean gimp_operation_overlay_process (GeglOperation *operation,
void *in_buf,
void *aux_buf,
void *aux2_buf,
void *out_buf,
glong samples,
const GeglRectangle *roi,
gint level);
G_DEFINE_TYPE (GimpOperationOverlayMode, gimp_operation_overlay_mode,
G_DEFINE_TYPE (GimpOperationOverlay, gimp_operation_overlay,
GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
static void
gimp_operation_overlay_mode_class_init (GimpOperationOverlayModeClass *klass)
gimp_operation_overlay_class_init (GimpOperationOverlayClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationPointComposer3Class *point_class;
@ -52,42 +52,42 @@ gimp_operation_overlay_mode_class_init (GimpOperationOverlayModeClass *klass)
point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
gegl_operation_class_set_keys (operation_class,
"name", "gimp:overlay-mode",
"name", "gimp:overlay",
"description", "GIMP overlay mode operation",
NULL);
point_class->process = gimp_operation_overlay_mode_process;
point_class->process = gimp_operation_overlay_process;
}
static void
gimp_operation_overlay_mode_init (GimpOperationOverlayMode *self)
gimp_operation_overlay_init (GimpOperationOverlay *self)
{
}
static gboolean
gimp_operation_overlay_mode_process (GeglOperation *operation,
void *in_buf,
void *aux_buf,
void *aux2_buf,
void *out_buf,
glong samples,
const GeglRectangle *roi,
gint level)
gimp_operation_overlay_process (GeglOperation *operation,
void *in_buf,
void *aux_buf,
void *aux2_buf,
void *out_buf,
glong samples,
const GeglRectangle *roi,
gint level)
{
gfloat opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
return gimp_operation_overlay_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, level);
return gimp_operation_overlay_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, level);
}
gboolean
gimp_operation_overlay_mode_process_pixels (gfloat *in,
gfloat *layer,
gfloat *mask,
gfloat *out,
gfloat opacity,
glong samples,
const GeglRectangle *roi,
gint level)
gimp_operation_overlay_process_pixels (gfloat *in,
gfloat *layer,
gfloat *mask,
gfloat *out,
gfloat opacity,
glong samples,
const GeglRectangle *roi,
gint level)
{
const gboolean has_mask = mask != NULL;

View File

@ -0,0 +1,62 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpoperationoverlay.h
* Copyright (C) 2008 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/>.
*/
#ifndef __GIMP_OPERATION_OVERLAY_H__
#define __GIMP_OPERATION_OVERLAY_H__
#include "../gimpoperationpointlayermode.h"
#define GIMP_TYPE_OPERATION_OVERLAY (gimp_operation_overlay_get_type ())
#define GIMP_OPERATION_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlay))
#define GIMP_OPERATION_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlayClass))
#define GIMP_IS_OPERATION_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_OVERLAY))
#define GIMP_IS_OPERATION_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_OVERLAY))
#define GIMP_OPERATION_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlayClass))
typedef struct _GimpOperationOverlay GimpOperationOverlay;
typedef struct _GimpOperationOverlayClass GimpOperationOverlayClass;
struct _GimpOperationOverlay
{
GimpOperationPointLayerMode parent_instance;
};
struct _GimpOperationOverlayClass
{
GimpOperationPointLayerModeClass parent_class;
};
GType gimp_operation_overlay_get_type (void) G_GNUC_CONST;
gboolean gimp_operation_overlay_process_pixels (gfloat *in,
gfloat *layer,
gfloat *mask,
gfloat *out,
gfloat opacity,
glong samples,
const GeglRectangle *roi,
gint level);
#endif /* __GIMP_OPERATION_OVERLAY_H__ */