Commit ef638faf authored by Michael Natterer's avatar Michael Natterer 😴

app: add gimp_image_get_layer_format()

parent 1e7d5e3c
......@@ -1556,6 +1556,36 @@ gimp_image_get_format_without_alpha (const GimpImage *image,
return NULL;
}
const Babl *
gimp_image_get_layer_format (const GimpImage *image,
gboolean with_alpha)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
switch (GIMP_IMAGE_GET_PRIVATE (image)->base_type)
{
case GIMP_RGB:
if (with_alpha)
return babl_format ("R'G'B'A u8");
else
return babl_format ("R'G'B' u8");
case GIMP_GRAY:
if (with_alpha)
return babl_format ("Y'A u8");
else
return babl_format ("Y' u8");
case GIMP_INDEXED:
if (with_alpha)
return gimp_image_colormap_get_rgba_format (image);
else
return gimp_image_colormap_get_rgb_format (image);
}
g_return_val_if_reached (NULL);
}
gint
gimp_image_get_ID (const GimpImage *image)
{
......
......@@ -177,6 +177,9 @@ const Babl * gimp_image_get_format_with_alpha (const GimpImage *image,
const Babl * gimp_image_get_format_without_alpha (const GimpImage *image,
GimpImageType type);
const Babl * gimp_image_get_layer_format (const GimpImage *image,
gboolean with_alpha);
gint gimp_image_get_ID (const GimpImage *image);
GimpImage * gimp_image_get_by_ID (Gimp *gimp,
gint id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment