app: add GimpPickable::get_babl_format_with_alpha()

This commit is contained in:
Michael Natterer 2012-03-18 15:37:12 +01:00
parent 5933f222c9
commit e9ecc40f02
5 changed files with 69 additions and 38 deletions

View File

@ -269,13 +269,14 @@ gimp_drawable_init (GimpDrawable *drawable)
static void
gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
{
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_item_get_image;
iface->get_babl_format = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_babl_format;
iface->get_image_type = (GimpImageType (*) (GimpPickable *pickable)) gimp_drawable_type;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_drawable_bytes;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_read_buffer;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles;
iface->get_pixel_at = gimp_drawable_get_pixel_at;
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_item_get_image;
iface->get_babl_format = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_babl_format;
iface->get_babl_format_with_alpha = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_babl_format_with_alpha;
iface->get_image_type = (GimpImageType (*) (GimpPickable *pickable)) gimp_drawable_type;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_drawable_bytes;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_read_buffer;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles;
iface->get_pixel_at = gimp_drawable_get_pixel_at;
}
static void

View File

@ -102,6 +102,8 @@ static void gimp_image_map_finalize (GObject *obje
static GimpImage * gimp_image_map_get_image (GimpPickable *pickable);
static const Babl * gimp_image_map_get_babl_format (GimpPickable *pickable);
static const Babl * gimp_image_map_get_babl_format_with_alpha
(GimpPickable *pickable);
static GimpImageType gimp_image_map_get_image_type (GimpPickable *pickable);
static gint gimp_image_map_get_bytes (GimpPickable *pickable);
static GeglBuffer * gimp_image_map_get_buffer (GimpPickable *pickable);
@ -154,13 +156,14 @@ gimp_image_map_class_init (GimpImageMapClass *klass)
static void
gimp_image_map_pickable_iface_init (GimpPickableInterface *iface)
{
iface->get_image = gimp_image_map_get_image;
iface->get_babl_format = gimp_image_map_get_babl_format;
iface->get_image_type = gimp_image_map_get_image_type;
iface->get_bytes = gimp_image_map_get_bytes;
iface->get_buffer = gimp_image_map_get_buffer;
iface->get_tiles = gimp_image_map_get_tiles;
iface->get_pixel_at = gimp_image_map_get_pixel_at;
iface->get_image = gimp_image_map_get_image;
iface->get_babl_format = gimp_image_map_get_babl_format;
iface->get_babl_format_with_alpha = gimp_image_map_get_babl_format_with_alpha;
iface->get_image_type = gimp_image_map_get_image_type;
iface->get_bytes = gimp_image_map_get_bytes;
iface->get_buffer = gimp_image_map_get_buffer;
iface->get_tiles = gimp_image_map_get_tiles;
iface->get_pixel_at = gimp_image_map_get_pixel_at;
}
static void
@ -272,6 +275,14 @@ gimp_image_map_get_babl_format (GimpPickable *pickable)
return gimp_pickable_get_babl_format (GIMP_PICKABLE (image_map->drawable));
}
static const Babl *
gimp_image_map_get_babl_format_with_alpha (GimpPickable *pickable)
{
GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
return gimp_pickable_get_babl_format_with_alpha (GIMP_PICKABLE (image_map->drawable));
}
static GimpImageType
gimp_image_map_get_image_type (GimpPickable *pickable)
{

View File

@ -111,7 +111,7 @@ gimp_pickable_get_babl_format (GimpPickable *pickable)
{
GimpPickableInterface *pickable_iface;
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), -1);
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
@ -121,6 +121,21 @@ gimp_pickable_get_babl_format (GimpPickable *pickable)
return NULL;
}
const Babl *
gimp_pickable_get_babl_format_with_alpha (GimpPickable *pickable)
{
GimpPickableInterface *pickable_iface;
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
if (pickable_iface->get_babl_format_with_alpha)
return pickable_iface->get_babl_format_with_alpha (pickable);
return NULL;
}
gint
gimp_pickable_get_bytes (GimpPickable *pickable)
{

View File

@ -35,20 +35,21 @@ struct _GimpPickableInterface
GTypeInterface base_iface;
/* virtual functions */
void (* flush) (GimpPickable *pickable);
GimpImage * (* get_image) (GimpPickable *pickable);
const Babl * (* get_babl_format) (GimpPickable *pickable);
GimpImageType (* get_image_type) (GimpPickable *pickable);
gint (* get_bytes) (GimpPickable *pickable);
GeglBuffer * (* get_buffer) (GimpPickable *pickable);
TileManager * (* get_tiles) (GimpPickable *pickable);
gboolean (* get_pixel_at) (GimpPickable *pickable,
gint x,
gint y,
guchar *pixel);
gint (* get_opacity_at) (GimpPickable *pickable,
gint x,
gint y);
void (* flush) (GimpPickable *pickable);
GimpImage * (* get_image) (GimpPickable *pickable);
const Babl * (* get_babl_format) (GimpPickable *pickable);
const Babl * (* get_babl_format_with_alpha) (GimpPickable *pickable);
GimpImageType (* get_image_type) (GimpPickable *pickable);
gint (* get_bytes) (GimpPickable *pickable);
GeglBuffer * (* get_buffer) (GimpPickable *pickable);
TileManager * (* get_tiles) (GimpPickable *pickable);
gboolean (* get_pixel_at) (GimpPickable *pickable,
gint x,
gint y,
guchar *pixel);
gint (* get_opacity_at) (GimpPickable *pickable,
gint x,
gint y);
};
@ -57,6 +58,8 @@ GType gimp_pickable_interface_get_type (void) G_GNUC_CONST;
void gimp_pickable_flush (GimpPickable *pickable);
GimpImage * gimp_pickable_get_image (GimpPickable *pickable);
const Babl * gimp_pickable_get_babl_format (GimpPickable *pickable);
const Babl * gimp_pickable_get_babl_format_with_alpha
(GimpPickable *pickable);
GimpImageType gimp_pickable_get_image_type (GimpPickable *pickable);
gint gimp_pickable_get_bytes (GimpPickable *pickable);
GeglBuffer * gimp_pickable_get_buffer (GimpPickable *pickable);

View File

@ -162,15 +162,16 @@ gimp_projection_init (GimpProjection *proj)
static void
gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
{
iface->flush = gimp_projection_pickable_flush;
iface->get_image = gimp_projection_get_image;
iface->get_babl_format = gimp_projection_get_babl_format;
iface->get_image_type = gimp_projection_get_image_type;
iface->get_bytes = gimp_projection_get_bytes;
iface->get_buffer = gimp_projection_get_buffer;
iface->get_tiles = gimp_projection_get_tiles;
iface->get_pixel_at = gimp_projection_get_pixel_at;
iface->get_opacity_at = gimp_projection_get_opacity_at;
iface->flush = gimp_projection_pickable_flush;
iface->get_image = gimp_projection_get_image;
iface->get_babl_format = gimp_projection_get_babl_format;
iface->get_babl_format_with_alpha = gimp_projection_get_babl_format; /* sic */
iface->get_image_type = gimp_projection_get_image_type;
iface->get_bytes = gimp_projection_get_bytes;
iface->get_buffer = gimp_projection_get_buffer;
iface->get_tiles = gimp_projection_get_tiles;
iface->get_pixel_at = gimp_projection_get_pixel_at;
iface->get_opacity_at = gimp_projection_get_opacity_at;
}
static void