You could use expose regions and in case the lasso size changes, only redraw the previous area covered by the lasso (i don't mean the full area btw but simply the areas covered by the lasso lines, so maybe "lines" would be more appropriate than "area").
For reference see: http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventExpose and http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-queue-draw-area
BTW this list is intended for development _of_ Gtk+ and not for applications using Gtk+, it would be better suited to ask on gtk-app-devel-list if this concerns an application.
--
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
For reference see: http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventExpose and http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-queue-draw-area
BTW this list is intended for development _of_ Gtk+ and not for applications using Gtk+, it would be better suited to ask on gtk-app-devel-list if this concerns an application.
Am 11. August 2008 20:57 schrieb Matt Kowalczyk <matt.kowalczyk@xxxxxxxxx>:
Hello,
I am trying to implement a lasso-type tool. I need to be able to load and display a user-selected image and provide the "lasso" tool ability wherein the user will be able to select a rectangular box within the image.
I've been working on this all day; and though I've come _very_ close to solving my problem; my solution is very slow. If I load an image that is say 1.5k x 1.5k pixels and make a large selection; the performance clearly degrades as the selection gets bigger.
My approach was to continually clear an rectangle the size of the previous selection (L * W) and redraw the new selection--a rectangle the size of the selection. This works well on small selections say < 500x500px but once outside that range the performance is terrible because it's equivalent to repainting the entire image.
I had to implement a double buffer scheme because I would get flickering. I used a Pixmap to do this.
Are there approach where in I can reduce the run-time complexity to solve this problem? Are there ways that I can overlay the selection box over the original image so that I don't have to redraw the original image just clear the selection that was made? I've been working on a solution wherein instead of redrawing the entire rectangle composing the selection, I would only redraw the border of the selection. That means, I only have to redraw O(2W + 2L) pixels, instead of O(W * L). Not sure if I'm headed down a dead-end road with this one. Is GnomeCanvas something I should look at?
The solution to only clear the pixels representing the selection clearly improves performance.
I'm just a newbie UI developer and wanted to solicit some suggestions as this is my first day working with GTK and I would hate to overlook a possibly simple solution to this problem.
Thanks!
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
--
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list