[gimp/goat-invasion: 444/526] app: remove image_type API from GimpBuffer
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 444/526] app: remove image_type API from GimpBuffer
- Date: Sun, 22 Apr 2012 13:36:35 +0000 (UTC)
commit 2c406e4989525482587eafb3523be368a40f5232
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 7 02:43:18 2012 +0200
app: remove image_type API from GimpBuffer
app/core/gimp-edit.c | 8 ++------
app/core/gimpbuffer.c | 18 ++----------------
app/core/gimpbuffer.h | 3 ---
app/core/gimpimage-new.c | 17 +++++++++++------
app/pdb/buffer-cmds.c | 3 ++-
tools/pdbgen/pdb/buffer.pdb | 3 ++-
6 files changed, 19 insertions(+), 33 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 3524740..0181f4f 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -582,12 +582,8 @@ gimp_edit_extract (GimpImage *image,
if (buffer)
{
- GimpBuffer *gimp_buffer;
- const Babl *format = gegl_buffer_get_format (buffer);
-
- gimp_buffer = gimp_buffer_new (buffer, _("Global Buffer"),
- GIMP_IMAGE_TYPE_FROM_BYTES (babl_format_get_bytes_per_pixel (format)),
- offset_x, offset_y, FALSE);
+ GimpBuffer *gimp_buffer = gimp_buffer_new (buffer, _("Global Buffer"),
+ offset_x, offset_y, FALSE);
g_object_unref (buffer);
return gimp_buffer;
diff --git a/app/core/gimpbuffer.c b/app/core/gimpbuffer.c
index 8f31d69..724960b 100644
--- a/app/core/gimpbuffer.c
+++ b/app/core/gimpbuffer.c
@@ -228,7 +228,6 @@ gimp_buffer_get_description (GimpViewable *viewable,
GimpBuffer *
gimp_buffer_new (GeglBuffer *buffer,
const gchar *name,
- GimpImageType image_type,
gint offset_x,
gint offset_y,
gboolean copy_pixels)
@@ -247,9 +246,8 @@ gimp_buffer_new (GeglBuffer *buffer,
else
gimp_buffer->buffer = g_object_ref (buffer);
- gimp_buffer->image_type = image_type;
- gimp_buffer->offset_x = offset_x;
- gimp_buffer->offset_y = offset_y;
+ gimp_buffer->offset_x = offset_x;
+ gimp_buffer->offset_y = offset_y;
return gimp_buffer;
}
@@ -262,17 +260,13 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
{
GimpBuffer *gimp_buffer;
GeglBuffer *buffer;
- gint channels;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (name != NULL, NULL);
- channels = gdk_pixbuf_get_n_channels (pixbuf);
-
buffer = gimp_pixbuf_create_buffer (pixbuf);
gimp_buffer = gimp_buffer_new (buffer, name,
- GIMP_IMAGE_TYPE_FROM_BYTES (channels),
offset_x, offset_y, FALSE);
g_object_unref (buffer);
@@ -304,14 +298,6 @@ gimp_buffer_get_format (const GimpBuffer *buffer)
return gegl_buffer_get_format (buffer->buffer);
}
-GimpImageType
-gimp_buffer_get_image_type (const GimpBuffer *buffer)
-{
- g_return_val_if_fail (GIMP_IS_BUFFER (buffer), 0);
-
- return buffer->image_type;
-}
-
GeglBuffer *
gimp_buffer_get_buffer (const GimpBuffer *buffer)
{
diff --git a/app/core/gimpbuffer.h b/app/core/gimpbuffer.h
index 3909c91..66c5c51 100644
--- a/app/core/gimpbuffer.h
+++ b/app/core/gimpbuffer.h
@@ -37,7 +37,6 @@ struct _GimpBuffer
GimpViewable parent_instance;
GeglBuffer *buffer;
- GimpImageType image_type;
gint offset_x;
gint offset_y;
};
@@ -52,7 +51,6 @@ GType gimp_buffer_get_type (void) G_GNUC_CONST;
GimpBuffer * gimp_buffer_new (GeglBuffer *buffer,
const gchar *name,
- GimpImageType image_type,
gint offset_x,
gint offset_y,
gboolean copy_pixels);
@@ -65,7 +63,6 @@ gint gimp_buffer_get_width (const GimpBuffer *buffer);
gint gimp_buffer_get_height (const GimpBuffer *buffer);
const Babl * gimp_buffer_get_format (const GimpBuffer *buffer);
-GimpImageType gimp_buffer_get_image_type (const GimpBuffer *buffer);
GeglBuffer * gimp_buffer_get_buffer (const GimpBuffer *buffer);
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 445e1fb..a9a78a1 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -26,6 +26,8 @@
#include "config/gimpcoreconfig.h"
+#include "gegl/gimp-gegl-utils.h"
+
#include "gimp.h"
#include "gimpbuffer.h"
#include "gimpchannel.h"
@@ -267,21 +269,23 @@ gimp_image_new_from_buffer (Gimp *gimp,
GimpImage *invoke,
GimpBuffer *paste)
{
- GimpImage *image;
- GimpLayer *layer;
- GimpImageType type;
+ GimpImage *image;
+ GimpLayer *layer;
+ const Babl *format;
+ gboolean has_alpha;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (invoke == NULL || GIMP_IS_IMAGE (invoke), NULL);
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
- type = gimp_buffer_get_image_type (paste);
+ format = gimp_buffer_get_format (paste);
+ has_alpha = babl_format_has_alpha (format);
/* create a new image (always of type GIMP_RGB) */
image = gimp_create_image (gimp,
gimp_buffer_get_width (paste),
gimp_buffer_get_height (paste),
- GIMP_IMAGE_TYPE_BASE_TYPE (type),
+ gimp_babl_format_get_base_type (format),
TRUE);
gimp_image_undo_disable (image);
@@ -297,7 +301,8 @@ gimp_image_new_from_buffer (Gimp *gimp,
layer = gimp_layer_new_from_buffer (gimp_buffer_get_buffer (paste),
image,
- gimp_image_get_format (image, type),
+ gimp_image_get_layer_format (image,
+ has_alpha),
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
diff --git a/app/pdb/buffer-cmds.c b/app/pdb/buffer-cmds.c
index 48e0c18..832b684 100644
--- a/app/pdb/buffer-cmds.c
+++ b/app/pdb/buffer-cmds.c
@@ -30,6 +30,7 @@
#include "core/gimpcontainer-filter.h"
#include "core/gimpcontainer.h"
#include "core/gimpparamspecs.h"
+#include "gegl/gimp-gegl-utils.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
@@ -263,7 +264,7 @@ buffer_get_image_type_invoker (GimpProcedure *procedure,
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
- image_type = gimp_buffer_get_image_type (buffer);
+ image_type = gimp_babl_format_get_image_type (gimp_buffer_get_format (buffer));
else
success = FALSE;
}
diff --git a/tools/pdbgen/pdb/buffer.pdb b/tools/pdbgen/pdb/buffer.pdb
index 943e3b3..55dec98 100644
--- a/tools/pdbgen/pdb/buffer.pdb
+++ b/tools/pdbgen/pdb/buffer.pdb
@@ -225,7 +225,7 @@ sub buffer_get_image_type {
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer)
- image_type = gimp_buffer_get_image_type (buffer);
+ image_type = gimp_babl_format_get_image_type (gimp_buffer_get_format (buffer));
else
success = FALSE;
}
@@ -235,6 +235,7 @@ CODE
@headers = qw(<string.h>
+ "gegl/gimp-gegl-utils.h"
"core/gimp.h"
"core/gimpbuffer.h"
"core/gimpcontainer.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]