mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 11:37:14 +00:00
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.
This commit is contained in:
parent
e737bf77fa
commit
ff931e1ded
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue