mirror of https://github.com/GNOME/gimp.git
app: add gimp_bpp_to_babl_format_with_alpha()
This commit is contained in:
parent
f5839e785e
commit
5933f222c9
|
@ -78,6 +78,50 @@ gimp_bpp_to_babl_format (guint bpp,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_bpp_to_babl_format_with_alpha:
|
||||
* @bpp: bytes per pixel
|
||||
* @linear: whether the pixels are linear or gamma-corrected.
|
||||
*
|
||||
* Return the Babl format to use for a given number of bytes per pixel.
|
||||
* This function assumes that the data is 8bit.
|
||||
*
|
||||
* Return value: the Babl format to use
|
||||
**/
|
||||
const Babl *
|
||||
gimp_bpp_to_babl_format_with_alpha (guint bpp,
|
||||
gboolean linear)
|
||||
{
|
||||
g_return_val_if_fail (bpp > 0 && bpp <= 4, NULL);
|
||||
|
||||
if (linear)
|
||||
{
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
return babl_format ("YA u8");
|
||||
case 3:
|
||||
case 4:
|
||||
return babl_format ("RGBA u8");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
return babl_format ("Y'A u8");
|
||||
case 3:
|
||||
case 4:
|
||||
return babl_format ("R'G'B'A u8");
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_layer_mode_to_gegl_operation (GimpLayerModeEffects mode)
|
||||
{
|
||||
|
|
|
@ -25,21 +25,23 @@
|
|||
#include <gdk-pixbuf/gdk-pixbuf.h> /* temp hack */
|
||||
|
||||
|
||||
const Babl * gimp_bpp_to_babl_format (guint bpp,
|
||||
gboolean linear) G_GNUC_CONST;
|
||||
const Babl * gimp_bpp_to_babl_format (guint bpp,
|
||||
gboolean linear) G_GNUC_CONST;
|
||||
const Babl * gimp_bpp_to_babl_format_with_alpha (guint bpp,
|
||||
gboolean linear) G_GNUC_CONST;
|
||||
|
||||
const gchar * gimp_layer_mode_to_gegl_operation (GimpLayerModeEffects mode) G_GNUC_CONST;
|
||||
const gchar * gimp_interpolation_to_gegl_filter (GimpInterpolationType interpolation) G_GNUC_CONST;
|
||||
const gchar * gimp_layer_mode_to_gegl_operation (GimpLayerModeEffects mode) G_GNUC_CONST;
|
||||
const gchar * gimp_interpolation_to_gegl_filter (GimpInterpolationType interpolation) G_GNUC_CONST;
|
||||
|
||||
GeglBuffer * gimp_tile_manager_create_buffer (TileManager *tm,
|
||||
const Babl *format,
|
||||
gboolean write);
|
||||
GeglBuffer * gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf);
|
||||
GeglBuffer * gimp_tile_manager_create_buffer (TileManager *tm,
|
||||
const Babl *format,
|
||||
gboolean write);
|
||||
GeglBuffer * gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf);
|
||||
|
||||
void gimp_gegl_buffer_refetch_tiles (GeglBuffer *buffer);
|
||||
void gimp_gegl_buffer_refetch_tiles (GeglBuffer *buffer);
|
||||
|
||||
void gimp_gegl_color_set_rgba (GeglColor *color,
|
||||
const GimpRGB *rgb);
|
||||
void gimp_gegl_color_set_rgba (GeglColor *color,
|
||||
const GimpRGB *rgb);
|
||||
|
||||
|
||||
#endif /* __GIMP_GEGL_UTILS_H__ */
|
||||
|
|
Loading…
Reference in New Issue