mirror of https://github.com/GNOME/gimp.git
app: remove image_type API from GimpBuffer
This commit is contained in:
parent
ec2d5647c0
commit
baa5ceb1e7
|
@ -582,11 +582,7 @@ 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)),
|
||||
GimpBuffer *gimp_buffer = gimp_buffer_new (buffer, _("Global Buffer"),
|
||||
offset_x, offset_y, FALSE);
|
||||
g_object_unref (buffer);
|
||||
|
||||
|
|
|
@ -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,7 +246,6 @@ 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;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpbuffer.h"
|
||||
#include "gimpchannel.h"
|
||||
|
@ -269,19 +271,21 @@ gimp_image_new_from_buffer (Gimp *gimp,
|
|||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GimpImageType type;
|
||||
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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue