[gegl] gegl_coordinate_relative_to_pixel new utility function
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl_coordinate_relative_to_pixel new utility function
- Date: Fri, 23 May 2014 11:58:43 +0000 (UTC)
commit 2afeb1ff0a9d00528a15b8a216d8acd96aafadf0
Author: Øyvind Kolås <pippin gimp org>
Date: Fri May 23 04:46:07 2014 +0200
gegl_coordinate_relative_to_pixel new utility function
Make it easier to write self documenting code for converting between relative
and pixel based coordinates. Given either buffer width or height as argument.
gegl/gegl-operations-util.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-operations-util.h b/gegl/gegl-operations-util.h
index d17a915..eb57896 100644
--- a/gegl/gegl-operations-util.h
+++ b/gegl/gegl-operations-util.h
@@ -113,6 +113,18 @@ void gegl_param_spec_set_property_key (GParamSpec *pspec,
const gchar *key_name,
const gchar *value);
+static inline gdouble
+gegl_coordinate_relative_to_pixel (gdouble relative, gdouble pixel_dim)
+{
+ return relative * pixel_dim;
+}
+
+static inline gdouble
+gegl_coordinate_pixel_to_relative (gdouble pixel, gdouble pixel_dim)
+{
+ return pixel / pixel_dim;
+}
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]