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

@ -271,6 +271,7 @@ 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_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;

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);
@ -156,6 +158,7 @@ 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_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;
@ -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

@ -38,6 +38,7 @@ struct _GimpPickableInterface
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);
@ -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

@ -165,6 +165,7 @@ 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_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;