[gimp] app: add gimp_babl_is_bounded()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_babl_is_bounded()
- Date: Wed, 20 Mar 2019 20:27:43 +0000 (UTC)
commit d7f12c9d26ea4be506d6d512ebab3bb30786d7ee
Author: Ell <ell_se yahoo com>
Date: Wed Mar 20 09:14:40 2019 -0400
app: add gimp_babl_is_bounded()
... which takes a GimpPrecision, and determines if its values are
bounded to the [0,1] range (which is currently only true for
integer precisions).
app/gegl/gimp-babl.c | 19 +++++++++++++++++++
app/gegl/gimp-babl.h | 1 +
2 files changed, 20 insertions(+)
---
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index 503e61bc7e..e18484e726 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -824,6 +824,25 @@ gimp_babl_is_valid (GimpImageBaseType base_type,
g_return_val_if_reached (FALSE);
}
+GimpComponentType
+gimp_babl_is_bounded (GimpPrecision precision)
+{
+ switch (gimp_babl_component_type (precision))
+ {
+ case GIMP_COMPONENT_TYPE_U8:
+ case GIMP_COMPONENT_TYPE_U16:
+ case GIMP_COMPONENT_TYPE_U32:
+ return TRUE;
+
+ case GIMP_COMPONENT_TYPE_HALF:
+ case GIMP_COMPONENT_TYPE_FLOAT:
+ case GIMP_COMPONENT_TYPE_DOUBLE:
+ return FALSE;
+ }
+
+ g_return_val_if_reached (FALSE);
+}
+
const Babl *
gimp_babl_format (GimpImageBaseType base_type,
GimpPrecision precision,
diff --git a/app/gegl/gimp-babl.h b/app/gegl/gimp-babl.h
index 8dfd10445a..209eea0e19 100644
--- a/app/gegl/gimp-babl.h
+++ b/app/gegl/gimp-babl.h
@@ -48,6 +48,7 @@ GimpPrecision gimp_babl_precision (GimpComponentType component,
gboolean gimp_babl_is_valid (GimpImageBaseType base_type,
GimpPrecision precision);
+GimpComponentType gimp_babl_is_bounded (GimpPrecision precision);
const Babl * gimp_babl_format (GimpImageBaseType base_type,
GimpPrecision precision,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]