[gimp] app: move gimp_drawable_fill() to gimpdrawable-fill.[ch]
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move gimp_drawable_fill() to gimpdrawable-fill.[ch]
- Date: Tue, 8 Mar 2016 00:46:16 +0000 (UTC)
commit ad2c01f8d83430f4bbebce44bd0af5e563899900
Author: Michael Natterer <mitch gimp org>
Date: Tue Mar 8 01:38:05 2016 +0100
app: move gimp_drawable_fill() to gimpdrawable-fill.[ch]
and get rid of gimp_drawable_fill_full().
app/actions/channels-commands.c | 1 +
app/actions/layers-commands.c | 1 +
app/core/gimpdrawable-fill.c | 44 ++++++++++++++++++++++++++++++++
app/core/gimpdrawable-fill.h | 12 +++++++++
app/core/gimpdrawable.c | 53 ---------------------------------------
app/core/gimpdrawable.h | 7 -----
app/core/gimpimage-new.c | 1 +
app/pdb/drawable-cmds.c | 1 +
tools/pdbgen/pdb/drawable.pdb | 2 +-
9 files changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 4466a2f..9b977d2 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -31,6 +31,7 @@
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
+#include "core/gimpdrawable-fill.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 00df25a..465afb3 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -33,6 +33,7 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
+#include "core/gimpdrawable-fill.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
diff --git a/app/core/gimpdrawable-fill.c b/app/core/gimpdrawable-fill.c
index cb9c8b2..f7ddde2 100644
--- a/app/core/gimpdrawable-fill.c
+++ b/app/core/gimpdrawable-fill.c
@@ -21,11 +21,14 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
+#include "libgimpcolor/gimpcolor.h"
+
#include "core-types.h"
#include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-utils.h"
+#include "gimp-utils.h"
#include "gimpbezierdesc.h"
#include "gimpchannel.h"
#include "gimpdrawable-fill.h"
@@ -43,6 +46,47 @@
/* public functions */
void
+gimp_drawable_fill (GimpDrawable *drawable,
+ GimpContext *context,
+ GimpFillType fill_type)
+{
+ GimpRGB color;
+ GimpPattern *pattern;
+
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (GIMP_IS_CONTEXT (context));
+
+ if (! gimp_get_fill_params (context, fill_type, &color, &pattern, NULL))
+ return;
+
+ if (pattern)
+ {
+ GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
+
+ gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
+ NULL, src_buffer, 0, 0);
+ g_object_unref (src_buffer);
+ }
+ else
+ {
+ GeglColor *gegl_color;
+
+ if (! gimp_drawable_has_alpha (drawable))
+ gimp_rgb_set_alpha (&color, 1.0);
+
+ gegl_color = gimp_gegl_color_new (&color);
+ gegl_buffer_set_color (gimp_drawable_get_buffer (drawable),
+ NULL, gegl_color);
+ g_object_unref (gegl_color);
+ }
+
+ gimp_drawable_update (drawable,
+ 0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable)));
+}
+
+void
gimp_drawable_fill_boundary (GimpDrawable *drawable,
GimpFillOptions *options,
const GimpBoundSeg *bound_segs,
diff --git a/app/core/gimpdrawable-fill.h b/app/core/gimpdrawable-fill.h
index c3364ba..65744e5 100644
--- a/app/core/gimpdrawable-fill.h
+++ b/app/core/gimpdrawable-fill.h
@@ -19,6 +19,18 @@
#define __GIMP_DRAWABLE_FILL_H__
+/* Lowlevel API that is used for initializing the entire drawable
+ * before it is added to the image, doesn't even push an undo.
+ */
+
+void gimp_drawable_fill (GimpDrawable *drawable,
+ GimpContext *context,
+ GimpFillType fill_type);
+
+
+/* Proper API that is used for actual editing (not just initializing)
+ */
+
void gimp_drawable_fill_boundary (GimpDrawable *drawable,
GimpFillOptions *options,
const GimpBoundSeg *bound_segs,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index e88591c..2af04d1 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1497,59 +1497,6 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
x, y, width, height);
}
-void
-gimp_drawable_fill (GimpDrawable *drawable,
- GimpContext *context,
- GimpFillType fill_type)
-{
- GimpRGB color;
- GimpPattern *pattern;
-
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
-
- if (! gimp_get_fill_params (context, fill_type, &color, &pattern, NULL))
- return;
-
- gimp_drawable_fill_full (drawable, &color, pattern);
-}
-
-void
-gimp_drawable_fill_full (GimpDrawable *drawable,
- const GimpRGB *color,
- const GimpPattern *pattern)
-{
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (color != NULL);
- g_return_if_fail (pattern == NULL || GIMP_IS_PATTERN (pattern));
-
- if (pattern)
- {
- GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
-
- gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
- NULL, src_buffer, 0, 0);
- g_object_unref (src_buffer);
- }
- else
- {
- GimpRGB c = *color;
- GeglColor *col;
-
- if (! gimp_drawable_has_alpha (drawable))
- gimp_rgb_set_alpha (&c, 1.0);
-
- col = gimp_gegl_color_new (&c);
- gegl_buffer_set_color (gimp_drawable_get_buffer (drawable),
- NULL, col);
- g_object_unref (col);
- }
-
- gimp_drawable_update (drawable,
- 0, 0,
- gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)));
-}
-
const Babl *
gimp_drawable_get_format (const GimpDrawable *drawable)
{
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index a0ad15b..5d72328 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -199,13 +199,6 @@ void gimp_drawable_push_undo (GimpDrawable *drawable,
gint width,
gint height);
-void gimp_drawable_fill (GimpDrawable *drawable,
- GimpContext *context,
- GimpFillType fill_type);
-void gimp_drawable_fill_full (GimpDrawable *drawable,
- const GimpRGB *color,
- const GimpPattern *pattern);
-
const Babl * gimp_drawable_get_format (const GimpDrawable *drawable);
const Babl * gimp_drawable_get_format_with_alpha
(const GimpDrawable *drawable);
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 4ebd670..5fd1648 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -35,6 +35,7 @@
#include "gimpbuffer.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
+#include "gimpdrawable-fill.h"
#include "gimpimage.h"
#include "gimpimage-color-profile.h"
#include "gimpimage-colormap.h"
diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c
index 6c2c8ea..c1e21e6 100644
--- a/app/pdb/drawable-cmds.c
+++ b/app/pdb/drawable-cmds.c
@@ -30,6 +30,7 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
+#include "core/gimpdrawable-fill.h"
#include "core/gimpdrawable-foreground-extract.h"
#include "core/gimpdrawable-offset.h"
#include "core/gimpdrawable-preview.h"
diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb
index a9f0ee7..984429a 100644
--- a/tools/pdbgen/pdb/drawable.pdb
+++ b/tools/pdbgen/pdb/drawable.pdb
@@ -94,7 +94,6 @@ sub drawable_fill {
$blurb = 'Fill the drawable with the specified fill mode.';
$help = <<'HELP';
-
This procedure fills the drawable. If the fill mode is foreground the
current foreground color is used. If the fill mode is background, the
current background color is used. If the fill type is white, then
@@ -119,6 +118,7 @@ HELP
);
%invoke = (
+ headers => [ qw("core/gimpdrawable-fill.h") ],
code => <<'CODE'
{
if (gimp_pdb_item_is_modifyable (GIMP_ITEM (drawable),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]