Implement gimp_drawable_get_linear

This commit is contained in:
Daniel Sabo 2013-04-30 15:05:53 -07:00
parent 0255a01f95
commit 8d88b71fad
3 changed files with 38 additions and 1 deletions

View File

@ -1596,9 +1596,13 @@ gimp_drawable_get_format_without_alpha (const GimpDrawable *drawable)
gboolean
gimp_drawable_get_linear (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return FALSE;
format = gegl_buffer_get_format (drawable->private->buffer);
return gimp_babl_format_get_linear (format);
}
gboolean

View File

@ -297,6 +297,37 @@ gimp_babl_format_get_precision (const Babl *format)
g_return_val_if_reached (-1);
}
gboolean
gimp_babl_format_get_linear (const Babl *format)
{
const Babl *model;
g_return_val_if_fail (format != NULL, FALSE);
model = babl_format_get_model (format);
if (model == babl_model ("Y") ||
model == babl_model ("YA") ||
model == babl_model ("RGB") ||
model == babl_model ("RGBA"))
{
return TRUE;
}
else if (model == babl_model ("Y'") ||
model == babl_model ("Y'A") ||
model == babl_model ("R'G'B'") ||
model == babl_model ("R'G'B'A"))
{
return FALSE;
}
else if (babl_format_is_palette (format))
{
return FALSE;
}
g_return_val_if_reached (FALSE);
}
const Babl *
gimp_babl_format (GimpImageBaseType base_type,
GimpPrecision precision,

View File

@ -28,6 +28,8 @@ const gchar * gimp_babl_get_description (const Babl *babl);
GimpImageBaseType gimp_babl_format_get_base_type (const Babl *format);
GimpPrecision gimp_babl_format_get_precision (const Babl *format);
gboolean gimp_babl_format_get_linear (const Babl *format);
const Babl * gimp_babl_format (GimpImageBaseType base_type,
GimpPrecision precision,