[gimp] Add an offset API to the GimpProjectable interface



commit 0f668e411e02b7144a3b3d57465737b104b99461
Author: Michael Natterer <mitch gimp org>
Date:   Mon Aug 24 15:54:59 2009 +0200

    Add an offset API to the GimpProjectable interface
    
    Add GimpProjectable::get_offset() and gimp_projectable_get_offset()
    which returns the offset of the projectable in image coordinates, so
    we can have projections that act as a viewport onto things that live
    in image coordinates.

 app/core/gimpprojectable.c |   20 ++++++++++++++++++++
 app/core/gimpprojectable.h |    6 ++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpprojectable.c b/app/core/gimpprojectable.c
index fcbf50c..c64937f 100644
--- a/app/core/gimpprojectable.c
+++ b/app/core/gimpprojectable.c
@@ -165,6 +165,26 @@ gimp_projectable_get_image (GimpProjectable *projectable)
 }
 
 void
+gimp_projectable_get_offset (GimpProjectable *projectable,
+                             gint            *x,
+                             gint            *y)
+{
+  GimpProjectableInterface *iface;
+
+  g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
+  g_return_if_fail (x != NULL);
+  g_return_if_fail (y != NULL);
+
+  iface = GIMP_PROJECTABLE_GET_INTERFACE (projectable);
+
+  *x = 0;
+  *y = 0;
+
+  if (iface->get_offset)
+    iface->get_offset (projectable, x, y);
+}
+
+void
 gimp_projectable_get_size (GimpProjectable *projectable,
                            gint            *width,
                            gint            *height)
diff --git a/app/core/gimpprojectable.h b/app/core/gimpprojectable.h
index 39e1713..e48e3d0 100644
--- a/app/core/gimpprojectable.h
+++ b/app/core/gimpprojectable.h
@@ -46,6 +46,9 @@ struct _GimpProjectableInterface
 
   /*  virtual functions  */
   GimpImage    * (* get_image)          (GimpProjectable *projectable);
+  void           (* get_offset)         (GimpProjectable *projectable,
+                                         gint            *x,
+                                         gint            *y);
   void           (* get_size)           (GimpProjectable *projectable,
                                          gint            *width,
                                          gint            *height);
@@ -70,6 +73,9 @@ void           gimp_projectable_flush              (GimpProjectable *projectable
 void           gimp_projectable_structure_changed  (GimpProjectable *projectable);
 
 GimpImage    * gimp_projectable_get_image          (GimpProjectable *projectable);
+void           gimp_projectable_get_offset         (GimpProjectable *projectable,
+                                                    gint            *x,
+                                                    gint            *y);
 void           gimp_projectable_get_size           (GimpProjectable *projectable,
                                                     gint            *width,
                                                     gint            *height);



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