Code

Factor out bitmap scanline check into separate function
[inkscape.git] / src / flood-context.cpp
1 #define __SP_FLOOD_CONTEXT_C__
3 /*
4  * Flood fill drawing context
5  *
6  * Author:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *   bulia byak <buliabyak@users.sf.net>
9  *   John Bintz <jcoswell@coswellproductions.org>
10  *
11  * Copyright (C) 2006      Johan Engelen <johan@shouraizou.nl>
12  * Copyright (C) 2000-2005 authors
13  * Copyright (C) 2000-2001 Ximian, Inc.
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
18 #include "config.h"
20 #include <gdk/gdkkeysyms.h>
21 #include <queue>
23 #include "macros.h"
24 #include "display/sp-canvas.h"
25 #include "document.h"
26 #include "sp-namedview.h"
27 #include "sp-object.h"
28 #include "sp-rect.h"
29 #include "selection.h"
30 #include "selection-chemistry.h"
31 #include "desktop-handles.h"
32 #include "snap.h"
33 #include "desktop.h"
34 #include "desktop-style.h"
35 #include "message-stack.h"
36 #include "message-context.h"
37 #include "pixmaps/cursor-paintbucket.xpm"
38 #include "flood-context.h"
39 #include "sp-metrics.h"
40 #include <glibmm/i18n.h>
41 #include "object-edit.h"
42 #include "xml/repr.h"
43 #include "xml/node-event-vector.h"
44 #include "prefs-utils.h"
45 #include "context-fns.h"
47 #include "display/nr-arena-item.h"
48 #include "display/nr-arena.h"
49 #include "display/nr-arena-image.h"
50 #include "display/canvas-arena.h"
51 #include "libnr/nr-pixops.h"
52 #include "libnr/nr-matrix-rotate-ops.h"
53 #include "libnr/nr-matrix-translate-ops.h"
54 #include "libnr/nr-rotate-fns.h"
55 #include "libnr/nr-scale-ops.h"
56 #include "libnr/nr-scale-translate-ops.h"
57 #include "libnr/nr-translate-matrix-ops.h"
58 #include "libnr/nr-translate-scale-ops.h"
59 #include "libnr/nr-matrix-ops.h"
60 #include "sp-item.h"
61 #include "sp-root.h"
62 #include "sp-defs.h"
63 #include "splivarot.h"
64 #include "livarot/Path.h"
65 #include "livarot/Shape.h"
66 #include "libnr/n-art-bpath.h"
67 #include "svg/svg.h"
69 #include "trace/trace.h"
70 #include "trace/potrace/inkscape-potrace.h"
72 static void sp_flood_context_class_init(SPFloodContextClass *klass);
73 static void sp_flood_context_init(SPFloodContext *flood_context);
74 static void sp_flood_context_dispose(GObject *object);
76 static void sp_flood_context_setup(SPEventContext *ec);
78 static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEvent *event);
79 static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
81 static void sp_flood_finish(SPFloodContext *rc);
83 static SPEventContextClass *parent_class;
86 GtkType sp_flood_context_get_type()
87 {
88     static GType type = 0;
89     if (!type) {
90         GTypeInfo info = {
91             sizeof(SPFloodContextClass),
92             NULL, NULL,
93             (GClassInitFunc) sp_flood_context_class_init,
94             NULL, NULL,
95             sizeof(SPFloodContext),
96             4,
97             (GInstanceInitFunc) sp_flood_context_init,
98             NULL,    /* value_table */
99         };
100         type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPFloodContext", &info, (GTypeFlags) 0);
101     }
102     return type;
105 static void sp_flood_context_class_init(SPFloodContextClass *klass)
107     GObjectClass *object_class = (GObjectClass *) klass;
108     SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
110     parent_class = (SPEventContextClass *) g_type_class_peek_parent(klass);
112     object_class->dispose = sp_flood_context_dispose;
114     event_context_class->setup = sp_flood_context_setup;
115     event_context_class->root_handler  = sp_flood_context_root_handler;
116     event_context_class->item_handler  = sp_flood_context_item_handler;
119 static void sp_flood_context_init(SPFloodContext *flood_context)
121     SPEventContext *event_context = SP_EVENT_CONTEXT(flood_context);
123     event_context->cursor_shape = cursor_paintbucket_xpm;
124     event_context->hot_x = 11;
125     event_context->hot_y = 30;
126     event_context->xp = 0;
127     event_context->yp = 0;
128     event_context->tolerance = 0;
129     event_context->within_tolerance = false;
130     event_context->item_to_select = NULL;
132     event_context->shape_repr = NULL;
133     event_context->shape_knot_holder = NULL;
135     flood_context->item = NULL;
137     new (&flood_context->sel_changed_connection) sigc::connection();
140 static void sp_flood_context_dispose(GObject *object)
142     SPFloodContext *rc = SP_FLOOD_CONTEXT(object);
143     SPEventContext *ec = SP_EVENT_CONTEXT(object);
145     rc->sel_changed_connection.disconnect();
146     rc->sel_changed_connection.~connection();
148     /* fixme: This is necessary because we do not grab */
149     if (rc->item) {
150         sp_flood_finish(rc);
151     }
153     if (ec->shape_repr) { // remove old listener
154         sp_repr_remove_listener_by_data(ec->shape_repr, ec);
155         Inkscape::GC::release(ec->shape_repr);
156         ec->shape_repr = 0;
157     }
159     if (rc->_message_context) {
160         delete rc->_message_context;
161     }
163     G_OBJECT_CLASS(parent_class)->dispose(object);
166 static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
167     NULL, /* child_added */
168     NULL, /* child_removed */
169     ec_shape_event_attr_changed,
170     NULL, /* content_changed */
171     NULL  /* order_changed */
172 };
174 /**
175 \brief  Callback that processes the "changed" signal on the selection;
176 destroys old and creates new knotholder
177 */
178 void sp_flood_context_selection_changed(Inkscape::Selection *selection, gpointer data)
180     SPFloodContext *rc = SP_FLOOD_CONTEXT(data);
181     SPEventContext *ec = SP_EVENT_CONTEXT(rc);
183     if (ec->shape_repr) { // remove old listener
184         sp_repr_remove_listener_by_data(ec->shape_repr, ec);
185         Inkscape::GC::release(ec->shape_repr);
186         ec->shape_repr = 0;
187     }
189     SPItem *item = selection->singleItem();
190     if (item) {
191         Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
192         if (shape_repr) {
193             ec->shape_repr = shape_repr;
194             Inkscape::GC::anchor(shape_repr);
195             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
196         }
197     }
200 static void sp_flood_context_setup(SPEventContext *ec)
202     SPFloodContext *rc = SP_FLOOD_CONTEXT(ec);
204     if (((SPEventContextClass *) parent_class)->setup) {
205         ((SPEventContextClass *) parent_class)->setup(ec);
206     }
208     SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
209     if (item) {
210         Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
211         if (shape_repr) {
212             ec->shape_repr = shape_repr;
213             Inkscape::GC::anchor(shape_repr);
214             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
215         }
216     }
218     rc->sel_changed_connection.disconnect();
219     rc->sel_changed_connection = sp_desktop_selection(ec->desktop)->connectChanged(
220         sigc::bind(sigc::ptr_fun(&sp_flood_context_selection_changed), (gpointer)rc)
221     );
223     rc->_message_context = new Inkscape::MessageContext((ec->desktop)->messageStack());
226 inline unsigned char * get_pixel(guchar *px, int x, int y, int width) {
227   return px + (x + y * width) * 4;
230 static bool compare_pixels(unsigned char *a, unsigned char *b, int tolerance) {
231   int diff = 0;
232   for (int i = 0; i < 4; i++) {
233     diff += (int)abs(a[i] - b[i]);
234   }
235   return ((diff / 4) <= tolerance);
238 static bool try_add_to_queue(std::queue<NR::Point> *fill_queue, guchar *px, guchar *trace_px, unsigned char *orig, int x, int y, int width, int tolerance, bool fill_switch) {
239   unsigned char *t = get_pixel(px, x, y, width);
240   if (compare_pixels(t, orig, tolerance)) {
241     unsigned char *trace_t = get_pixel(trace_px, x, y, width);
242     if (trace_t[3] != 255) {
243       if (fill_switch) {
244         fill_queue->push(NR::Point(x, y));
245       }
246     }
247     return false;
248   }
249   return true;
252 static void do_trace(GdkPixbuf *px, SPDesktop *desktop, NR::Matrix transform) {
253     SPDocument *document = sp_desktop_document(desktop);
254     
255     Inkscape::Trace::Potrace::PotraceTracingEngine pte;
256         
257     pte.setTraceType(Inkscape::Trace::Potrace::TRACE_BRIGHTNESS);
258     pte.setInvert(false);
260     Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(px, true);
261     
262     std::vector<Inkscape::Trace::TracingEngineResult> results = pte.trace(pixbuf);
263     
264     Inkscape::XML::Node *layer_repr = SP_GROUP(desktop->currentLayer())->repr;
265     Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
267     long totalNodeCount = 0L;
269     double offset = prefs_get_double_attribute_limited("tools.paintbucket", "offset", 1.5, 0.0, 2.0);
271     for (unsigned int i=0 ; i<results.size() ; i++) {
272         Inkscape::Trace::TracingEngineResult result = results[i];
273         totalNodeCount += result.getNodeCount();
275         Inkscape::XML::Node *pathRepr = xml_doc->createElement("svg:path");
276         /* Set style */
277         sp_desktop_apply_style_tool (desktop, pathRepr, "tools.paintbucket", false);
279         NArtBpath *bpath = sp_svg_read_path(result.getPathData().c_str());
280         Path *path = bpath_to_Path(bpath);
281         g_free(bpath);
282         
283         Shape *path_shape = new Shape();
284         
285         path->ConvertWithBackData(0.03);
286         path->Fill(path_shape, 0);
287         delete path;
288         
289         Shape *expanded_path_shape = new Shape();
290         
291         expanded_path_shape->ConvertToShape(path_shape, fill_nonZero);
292         path_shape->MakeOffset(expanded_path_shape, offset, join_round, 4);
293         expanded_path_shape->ConvertToShape(path_shape, fill_positive);
295         Path *expanded_path = new Path();
296         
297         expanded_path->Reset();
298         expanded_path_shape->ConvertToForme(expanded_path);
299         expanded_path->ConvertEvenLines(1.0);
300         expanded_path->Simplify(1.0);
301         
302         delete path_shape;
303         delete expanded_path_shape;
304         
305         gchar *str = expanded_path->svg_dump_path();
306         delete expanded_path;
307         pathRepr->setAttribute("d", str);
308         g_free(str);
310         layer_repr->addChild(pathRepr, NULL);
312         SPObject *reprobj = document->getObjectByRepr(pathRepr);
313         if (reprobj) {
314             sp_item_write_transform(SP_ITEM(reprobj), pathRepr, transform, NULL);
315             
316             // premultiply the item transform by the accumulated parent transform in the paste layer
317             NR::Matrix local = sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer()));
318             if (!local.test_identity()) {
319                 gchar const *t_str = pathRepr->attribute("transform");
320                 NR::Matrix item_t (NR::identity());
321                 if (t_str)
322                     sp_svg_transform_read(t_str, &item_t);
323                 item_t *= local.inverse();
324                 // (we're dealing with unattached repr, so we write to its attr instead of using sp_item_set_transform)
325                 gchar *affinestr=sp_svg_transform_write(item_t);
326                 pathRepr->setAttribute("transform", affinestr);
327                 g_free(affinestr);
328             }
330             Inkscape::Selection *selection = sp_desktop_selection(desktop);
331             selection->set(reprobj);
332             pathRepr->setPosition(-1);
333         }
334         
335         Inkscape::GC::release(pathRepr);
336     }
339 struct bitmap_coords_info {
340   bool is_left;
341   int x;
342   int y;
343   int y_limit;
344   int width;
345   int tolerance;
346   bool top_fill;
347   bool bottom_fill;
348   NR::Rect bbox;
349   NR::Rect screen;
350 };
352 enum {
353   SP_FLOOD_TRACE_OK,
354   SP_FLOOD_TRACE_ABORTED,
355   SP_FLOOD_TRACE_BOUNDARY
356 };
358 static int perform_bitmap_scanline_check(std::queue<NR::Point> *fill_queue, guchar *px, guchar *trace_px, unsigned char *orig_color, bitmap_coords_info bci) {
359     bool aborted = false;
360     bool reached_screen_boundary = false;
361     bool ok;
362   
363     bool keep_tracing;
364     unsigned char *t, *trace_t;
365   
366     do {
367         ok = false;
368         if (bci.is_left) {
369             keep_tracing = (bci.x >= 0);
370         } else {
371             keep_tracing = (bci.x < bci.width);
372         }
373         
374         if (keep_tracing) {
375             t = get_pixel(px, bci.x, bci.y, bci.width);
376             if (compare_pixels(t, orig_color, bci.tolerance)) {
377                 for (int i = 0; i < 4; i++) { t[i] = 255 - t[i]; }
378                 trace_t = get_pixel(trace_px, bci.x, bci.y, bci.width);
379                 trace_t[3] = 255; 
380                 if (bci.y > 0) { 
381                     bci.top_fill = try_add_to_queue(fill_queue, px, trace_px, orig_color, bci.x, bci.y - 1, bci.width, bci.tolerance, bci.top_fill);
382                 }
383                 if (bci.y < bci.y_limit) { 
384                     bci.bottom_fill = try_add_to_queue(fill_queue, px, trace_px, orig_color, bci.x, bci.y + 1, bci.width, bci.tolerance, bci.bottom_fill);
385                 }
386                 if (bci.is_left) {
387                     bci.x--;
388                 } else {
389                     bci.x++;
390                 }
391                 ok = true;
392             }
393         } else {
394             if (bci.bbox.min()[NR::X] > bci.screen.min()[NR::X]) {
395                 aborted = true; break;
396             } else {
397                 reached_screen_boundary = true;
398             }
399         }
400     } while (ok);
401     
402     if (aborted) { return SP_FLOOD_TRACE_ABORTED; }
403     if (reached_screen_boundary) { return SP_FLOOD_TRACE_BOUNDARY; }
404     return SP_FLOOD_TRACE_OK;
407 static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *event) {
408     SPDesktop *desktop = event_context->desktop;
409     SPDocument *document = sp_desktop_document(desktop);
411     /* Create new arena */
412     NRArena *arena = NRArena::create();
413     unsigned dkey = sp_item_display_key_new(1);
415     sp_document_ensure_up_to_date (document);
416     
417     SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
418     NR::Rect bbox = document_root->invokeBbox(NR::identity());
420     if (bbox.isEmpty()) { 
421       desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill."));
422       return;
423     }
424     
425     double zoom_scale = desktop->current_zoom();
426     double padding = 1.6;
428     NR::Rect screen = desktop->get_display_area();
430     int width = (int)ceil(screen.extent(NR::X) * zoom_scale * padding);
431     int height = (int)ceil(screen.extent(NR::Y) * zoom_scale * padding);
433     NR::Point origin(screen.min()[NR::X],
434                      sp_document_height(document) - screen.extent(NR::Y) - screen.min()[NR::Y]);
435                      
436     origin[NR::X] = origin[NR::X] + (screen.extent(NR::X) * ((1 - padding) / 2));
437     origin[NR::Y] = origin[NR::Y] + (screen.extent(NR::Y) * ((1 - padding) / 2));
438     
439     NR::scale scale(zoom_scale, zoom_scale);
440     NR::Matrix affine = scale * NR::translate(-origin * scale);
441     
442     /* Create ArenaItems and set transform */
443     NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(document)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
444     nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine);
446     NRGC gc(NULL);
447     nr_matrix_set_identity(&gc.transform);
448     
449     NRRectL final_bbox;
450     final_bbox.x0 = 0;
451     final_bbox.y0 = 0;//row;
452     final_bbox.x1 = width;
453     final_bbox.y1 = height;//row + num_rows;
454     
455     nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
457     guchar *px = g_new(guchar, 4 * width * height);
458     memset(px, 0x00, 4 * width * height);
460     NRPixBlock B;
461     nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N,
462                               final_bbox.x0, final_bbox.y0, final_bbox.x1, final_bbox.y1,
463                               px, 4 * width, FALSE, FALSE );
464     
465     nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE );
466     nr_pixblock_release(&B);
467     
468     // Hide items
469     sp_item_invoke_hide(SP_ITEM(sp_document_root(document)), dkey);
470     
471     nr_arena_item_unref(root);
472     nr_object_unref((NRObject *) arena);
473     
474     NR::Point pw = NR::Point(event->button.x / zoom_scale, sp_document_height(document) + (event->button.y / zoom_scale)) * affine;
475     
476     pw[NR::X] = (int)MIN(width - 1, MAX(0, pw[NR::X]));
477     pw[NR::Y] = (int)MIN(height - 1, MAX(0, pw[NR::Y]));
479     guchar *trace_px = g_new(guchar, 4 * width * height);
480     memset(trace_px, 0x00, 4 * width * height);
481     
482     std::queue<NR::Point> fill_queue;
483     fill_queue.push(pw);
484     
485     bool aborted = false;
486     int y_limit = height - 1;
487     
488     unsigned char orig_color[4];
489     unsigned char *orig_px = get_pixel(px, (int)pw[NR::X], (int)pw[NR::Y], width);
490     for (int i = 0; i < 4; i++) { orig_color[i] = orig_px[i]; }
492     int tolerance = (255 * prefs_get_int_attribute_limited("tools.paintbucket", "tolerance", 1, 0, 100)) / 100;
494     bool reached_screen_boundary = false;
496     bitmap_coords_info bci;
497     
498     bci.y_limit = y_limit;
499     bci.width = width;
500     bci.tolerance = tolerance;
501     bci.bbox = bbox;
502     bci.screen = screen;
504     while (!fill_queue.empty() && !aborted) {
505       NR::Point cp = fill_queue.front();
506       fill_queue.pop();
507       unsigned char *s = get_pixel(px, (int)cp[NR::X], (int)cp[NR::Y], width);
508       
509       // same color at this point
510       if (compare_pixels(s, orig_color, tolerance)) {
511         int x = (int)cp[NR::X];
512         int y = (int)cp[NR::Y];
513         
514         bool top_fill = true;
515         bool bottom_fill = true;
516         
517         if (y > 0) { 
518           top_fill = try_add_to_queue(&fill_queue, px, trace_px, orig_color, x, y - 1, width, tolerance, top_fill);
519         } else {
520           if (bbox.min()[NR::Y] > screen.min()[NR::Y]) {
521             aborted = true; break;
522           } else {
523             reached_screen_boundary = true;
524           }
525         }
526         if (y < y_limit) { 
527           bottom_fill = try_add_to_queue(&fill_queue, px, trace_px, orig_color, x, y + 1, width, tolerance, bottom_fill);
528         } else {
529           if (bbox.max()[NR::Y] < screen.max()[NR::Y]) {
530             aborted = true; break;
531           } else {
532             reached_screen_boundary = true;
533           }
534         }
535         
536         bci.is_left = true;
537         bci.x = x;
538         bci.y = y;
539         bci.top_fill = top_fill;
540         bci.bottom_fill = bottom_fill;
541         
542         int result = perform_bitmap_scanline_check(&fill_queue, px, trace_px, orig_color, bci);
543         
544         switch (result) {
545             case SP_FLOOD_TRACE_ABORTED:
546                 aborted = true;
547                 break;
548             case SP_FLOOD_TRACE_BOUNDARY:
549                 reached_screen_boundary = true;
550                 break;
551         }
552         
553         bci.is_left = false;
554         bci.x = x + 1;
555         bci.y = y;
556         bci.top_fill = top_fill;
557         bci.bottom_fill = bottom_fill;
558         
559         result = perform_bitmap_scanline_check(&fill_queue, px, trace_px, orig_color, bci);
560         
561         switch (result) {
562             case SP_FLOOD_TRACE_ABORTED:
563                 aborted = true;
564                 break;
565             case SP_FLOOD_TRACE_BOUNDARY:
566                 reached_screen_boundary = true;
567                 break;
568         }
569       }
570     }
571     
572     g_free(px);
573     
574     if (aborted) {
575       g_free(trace_px);
576       desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill."));
577       return;
578     }
579     
580     if (reached_screen_boundary) {
581       desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Only the visible part of the bounded area was filled.</b> If you want to fill all of the area, undo, zoom out, and fill again.")); 
582     }
583     
584     GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(trace_px,
585                                       GDK_COLORSPACE_RGB,
586                                       TRUE,
587                                       8, width, height, width * 4,
588                                       (GdkPixbufDestroyNotify)g_free,
589                                       NULL);
591     NR::Matrix inverted_affine = NR::Matrix(affine).inverse();
592     
593     do_trace(pixbuf, desktop, inverted_affine);
595     g_free(trace_px);
596     
597     sp_document_done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area"));
600 static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
602     gint ret = FALSE;
604     switch (event->type) {
605     case GDK_BUTTON_PRESS:
606         break;
607         // motion and release are always on root (why?)
608     default:
609         break;
610     }
612     if (((SPEventContextClass *) parent_class)->item_handler) {
613         ret = ((SPEventContextClass *) parent_class)->item_handler(event_context, item, event);
614     }
616     return ret;
619 static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEvent *event)
621     SPDesktop *desktop = event_context->desktop;
623     gint ret = FALSE;
624     switch (event->type) {
625     case GDK_BUTTON_PRESS:
626         if ( event->button.button == 1 ) {
627             sp_flood_do_flood_fill(event_context, event);
629             ret = TRUE;
630         }
631         break;
632     case GDK_KEY_PRESS:
633         switch (get_group0_keyval (&event->key)) {
634         case GDK_Up:
635         case GDK_Down:
636         case GDK_KP_Up:
637         case GDK_KP_Down:
638             // prevent the zoom field from activation
639             if (!MOD__CTRL_ONLY)
640                 ret = TRUE;
641             break;
642         case GDK_Escape:
643             sp_desktop_selection(desktop)->clear();
644         default:
645             break;
646         }
647         break;
648     default:
649         break;
650     }
652     if (!ret) {
653         if (((SPEventContextClass *) parent_class)->root_handler) {
654             ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
655         }
656     }
658     return ret;
662 static void sp_flood_finish(SPFloodContext *rc)
664     rc->_message_context->clear();
666     if ( rc->item != NULL ) {
667         SPDesktop * desktop;
669         desktop = SP_EVENT_CONTEXT_DESKTOP(rc);
671         SP_OBJECT(rc->item)->updateRepr();
673         sp_canvas_end_forced_full_redraws(desktop->canvas);
675         sp_desktop_selection(desktop)->set(rc->item);
676         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET,
677                          _("Fill bounded area"));
679         rc->item = NULL;
680     }
683 /*
684   Local Variables:
685   mode:c++
686   c-file-style:"stroustrup"
687   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
688   indent-tabs-mode:nil
689   fill-column:99
690   End:
691 */
692 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :