mirror of https://github.com/GNOME/gimp.git
app: add gimp_babl_format() and use it in gimp_image_get_format()
This commit is contained in:
parent
ff931e1ded
commit
15d1827ead
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "config/gimpcoreconfig.h"
|
#include "config/gimpcoreconfig.h"
|
||||||
|
|
||||||
#include "gegl/gimp-gegl-utils.h"
|
#include "gegl/gimp-babl.h"
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
#include "gimp-parasites.h"
|
#include "gimp-parasites.h"
|
||||||
|
@ -1484,16 +1484,8 @@ gimp_image_get_format (const GimpImage *image,
|
||||||
switch (base_type)
|
switch (base_type)
|
||||||
{
|
{
|
||||||
case GIMP_RGB:
|
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:
|
case GIMP_GRAY:
|
||||||
if (with_alpha)
|
return gimp_babl_format (base_type, with_alpha);
|
||||||
return babl_format ("Y'A u8");
|
|
||||||
else
|
|
||||||
return babl_format ("Y' u8");
|
|
||||||
|
|
||||||
case GIMP_INDEXED:
|
case GIMP_INDEXED:
|
||||||
if (with_alpha)
|
if (with_alpha)
|
||||||
|
|
|
@ -146,3 +146,29 @@ gimp_babl_format_get_base_type (const Babl *format)
|
||||||
|
|
||||||
g_return_val_if_reached (-1);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
|
|
||||||
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);
|
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__ */
|
#endif /* __GIMP_BABL_H__ */
|
||||||
|
|
Loading…
Reference in New Issue