Commit 3c4f9d55 authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: use the new functions added with the last commit

parent dd103d22
......@@ -1632,25 +1632,7 @@ gimp_drawable_type (const GimpDrawable *drawable)
format = gegl_buffer_get_format (drawable->private->buffer);
if (format == babl_format ("Y' u8"))
return GIMP_GRAY_IMAGE;
else if (format == babl_format ("Y'A u8"))
return GIMP_GRAYA_IMAGE;
else if (format == babl_format ("R'G'B' u8"))
return GIMP_RGB_IMAGE;
else if (format == babl_format ("R'G'B'A u8"))
return GIMP_RGBA_IMAGE;
else
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
if (format == gimp_image_get_format (image, GIMP_INDEXED_IMAGE))
return GIMP_INDEXED_IMAGE;
if (format == gimp_image_get_format (image, GIMP_INDEXEDA_IMAGE))
return GIMP_INDEXEDA_IMAGE;
}
g_return_val_if_reached (-1);
return gimp_babl_format_get_image_type (format);
}
GimpImageType
......@@ -1670,67 +1652,31 @@ gimp_drawable_get_base_type (const GimpDrawable *drawable)
format = gegl_buffer_get_format (drawable->private->buffer);
if (format == babl_format ("Y' u8") ||
format == babl_format ("Y'A u8"))
{
return GIMP_GRAY;
}
else if (format == babl_format ("R'G'B' u8") ||
format == babl_format ("R'G'B'A u8"))
{
return GIMP_RGB;
}
else
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
if (format == gimp_image_get_format (image, GIMP_INDEXED_IMAGE) ||
format == gimp_image_get_format (image, GIMP_INDEXEDA_IMAGE))
{
return GIMP_INDEXED;
}
}
g_return_val_if_reached (-1);
return gimp_babl_format_get_base_type (format);
}
gboolean
gimp_drawable_is_rgb (const GimpDrawable *drawable)
{
GimpImageType type;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
type = gimp_drawable_type (drawable);
return (type == GIMP_RGB_IMAGE ||
type == GIMP_RGBA_IMAGE);
return (gimp_drawable_get_base_type (drawable) == GIMP_RGB);
}
gboolean
gimp_drawable_is_gray (const GimpDrawable *drawable)
{
GimpImageType type;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
type = gimp_drawable_type (drawable);
return (type == GIMP_GRAY_IMAGE ||
type == GIMP_GRAYA_IMAGE);
return (gimp_drawable_get_base_type (drawable) == GIMP_GRAY);
}
gboolean
gimp_drawable_is_indexed (const GimpDrawable *drawable)
{
GimpImageType type;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
type = gimp_drawable_type (drawable);
return (type == GIMP_INDEXED_IMAGE ||
type == GIMP_INDEXEDA_IMAGE);
return (gimp_drawable_get_base_type (drawable) == GIMP_INDEXED);
}
gint
......
......@@ -92,7 +92,9 @@ drawable_type_with_alpha_invoker (GimpProcedure *procedure,
if (success)
{
type_with_alpha = gimp_drawable_type_with_alpha (drawable);
const Babl *format = gimp_drawable_get_format_with_alpha (drawable);
type_with_alpha = gimp_babl_format_get_image_type (format);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
......
......@@ -347,7 +347,9 @@ HELP
%invoke = (
code => <<'CODE'
{
type_with_alpha = gimp_drawable_type_with_alpha (drawable);
const Babl *format = gimp_drawable_get_format_with_alpha (drawable);
type_with_alpha = gimp_babl_format_get_image_type (format);
}
CODE
);
......
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