[gegl] Add gegl_rectangle_new



commit 932767ad41a481aace31d41c20285b5e5c5355ab
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Tue Jun 4 01:24:35 2013 -0700

    Add gegl_rectangle_new

 gegl/gegl-utils.c |   16 ++++++++++++++++
 gegl/gegl-utils.h |   14 ++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-utils.c b/gegl/gegl-utils.c
index 7b3a9d6..6b76ea0 100644
--- a/gegl/gegl-utils.c
+++ b/gegl/gegl-utils.c
@@ -41,6 +41,22 @@ _gegl_float_epsilon_equal (float v1, float v2)
   return diff > -GEGL_FLOAT_EPSILON && diff < GEGL_FLOAT_EPSILON;
 }
 
+GeglRectangle *
+gegl_rectangle_new (gint           x,
+                    gint           y,
+                    guint          w,
+                    guint          h)
+{
+  GeglRectangle *r = g_new (GeglRectangle, 1);
+
+  r->x      = x;
+  r->y      = y;
+  r->width  = w;
+  r->height = h;
+
+  return r;
+}
+
 void
 gegl_rectangle_set (GeglRectangle *r,
                     gint           x,
diff --git a/gegl/gegl-utils.h b/gegl/gegl-utils.h
index 6045a0f..e479ea1 100644
--- a/gegl/gegl-utils.h
+++ b/gegl/gegl-utils.h
@@ -39,6 +39,20 @@ G_BEGIN_DECLS
  */
 
 /**
+ * gegl_rectangle_new:
+ * @x: upper left x coordinate
+ * @y: upper left y coordinate
+ * @width: width in pixels.
+ * @height: height in pixels.
+ *
+ * Creates a new rectangle set with the values from @x, @y, @width and @height.
+ */
+GeglRectangle *gegl_rectangle_new        (gint                 x,
+                                          gint                 y,
+                                          guint                width,
+                                          guint                height);
+
+/**
  * gegl_rectangle_set:
  * @rectangle: a #GeglRectangle
  * @x: upper left x coordinate


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]