diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index b8e665c73b..1ec880495f 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -32,7 +32,7 @@ #include "config/gimpcoreconfig.h" -#include "gegl/gimp-gegl-utils.h" +#include "gegl/gimp-babl.h" #include "gimp.h" #include "gimp-parasites.h" @@ -1484,16 +1484,8 @@ gimp_image_get_format (const GimpImage *image, switch (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"); + return gimp_babl_format (base_type, with_alpha); case GIMP_INDEXED: if (with_alpha) diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c index 63d47fabde..9968ffc455 100644 --- a/app/gegl/gimp-babl.c +++ b/app/gegl/gimp-babl.c @@ -146,3 +146,29 @@ gimp_babl_format_get_base_type (const Babl *format) g_return_val_if_reached (-1); } + +const Babl * +gimp_babl_format (GimpImageBaseType base_type, + gboolean with_alpha) +{ + switch (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: + /* need to use the image's api for this */ + break; + } + + g_return_val_if_reached (NULL); +} diff --git a/app/gegl/gimp-babl.h b/app/gegl/gimp-babl.h index 9d565926a6..704f6112ca 100644 --- a/app/gegl/gimp-babl.h +++ b/app/gegl/gimp-babl.h @@ -24,9 +24,12 @@ 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); +GimpImageBaseType gimp_babl_format_get_base_type (const Babl *format); + +const Babl * gimp_babl_format (GimpImageBaseType base_type, + gboolean with_alpha); #endif /* __GIMP_BABL_H__ */