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

app: move gimp_babl_format_get_base_type() to gimp-babl.[ch]

The GimpImageBaseType enum is going to go away, but a format -> enum
API is going to stay around.
parent e737bf77
......@@ -28,6 +28,7 @@
#include "base/pixel-region.h"
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-nodes.h"
#include "gegl/gimp-gegl-utils.h"
......
......@@ -26,7 +26,7 @@
#include "config/gimpcoreconfig.h"
#include "gegl/gimp-gegl-utils.h"
#include "gegl/gimp-babl.h"
#include "gimp.h"
#include "gimpbuffer.h"
......
......@@ -122,3 +122,27 @@ gimp_babl_get_description (const Babl *babl)
return g_strconcat ("ERROR: unknown Babl format ",
babl_get_name (babl), NULL);
}
GimpImageBaseType
gimp_babl_format_get_base_type (const Babl *format)
{
g_return_val_if_fail (format != NULL, -1);
if (format == babl_format ("Y u8") ||
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 if (babl_format_is_palette (format))
{
return GIMP_INDEXED;
}
g_return_val_if_reached (-1);
}
......@@ -22,9 +22,11 @@
#define __GIMP_BABL_H__
void gimp_babl_init (void);
void gimp_babl_init (void);
const gchar * gimp_babl_get_description (const Babl *babl);
const gchar * gimp_babl_get_description (const Babl *babl);
GimpImageBaseType gimp_babl_format_get_base_type (const Babl *format);
#endif /* __GIMP_BABL_H__ */
......@@ -57,30 +57,6 @@ gimp_babl_format_get_image_type (const Babl *format)
g_return_val_if_reached (-1);
}
GimpImageBaseType
gimp_babl_format_get_base_type (const Babl *format)
{
g_return_val_if_fail (format != NULL, -1);
if (format == babl_format ("Y u8") ||
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 if (babl_format_is_palette (format))
{
return GIMP_INDEXED;
}
g_return_val_if_reached (-1);
}
/**
* gimp_bpp_to_babl_format:
* @bpp: bytes per pixel
......
......@@ -25,8 +25,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h> /* temp hack */
GimpImageType gimp_babl_format_get_image_type (const Babl *format);
GimpImageBaseType gimp_babl_format_get_base_type (const Babl *format);
GimpImageType gimp_babl_format_get_image_type (const Babl *format);
const Babl * gimp_bpp_to_babl_format (guint bpp) G_GNUC_CONST;
const Babl * gimp_bpp_to_babl_format_with_alpha (guint bpp) G_GNUC_CONST;
......
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