gegl r2640 - in trunk: . operations/external



Author: ok
Date: Sun Oct 19 15:59:00 2008
New Revision: 2640
URL: http://svn.gnome.org/viewvc/gegl?rev=2640&view=rev

Log:
* operations/external/fill.c: (detect), (gegl_chant_class_init): use
cairo for hit detection.


Modified:
   trunk/ChangeLog
   trunk/operations/external/fill.c

Modified: trunk/operations/external/fill.c
==============================================================================
--- trunk/operations/external/fill.c	(original)
+++ trunk/operations/external/fill.c	Sun Oct 19 15:59:00 2008
@@ -124,6 +124,31 @@
   return  TRUE;
 }
 
+static GeglNode *detect (GeglOperation *operation,
+                         gint           x,
+                         gint           y)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  cairo_t *cr;
+  cairo_surface_t *surface;
+  gchar *data = "     ";
+  gboolean result;
+
+  surface = cairo_image_surface_create_for_data ((guchar*)data,
+                                                 CAIRO_FORMAT_ARGB32,
+                                                 1,1,4);
+  cr = cairo_create (surface);
+  /*cairo_translate (cr, -result->x, -result->y);*/
+  gegl_vector_cairo_play (o->vector, cr);
+  result = cairo_in_fill (cr, x, y);
+  cairo_destroy (cr);
+
+  if (result)
+    return operation->node;
+
+  return NULL;
+}
+
 static void
 gegl_chant_class_init (GeglChantClass *klass)
 {
@@ -136,6 +161,7 @@
   source_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
   operation_class->prepare = prepare;
+  operation_class->detect = detect;
 
   operation_class->name        = "gegl:fill";
   operation_class->categories  = "render";



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