lasso tool
- From: "Matt Kowalczyk" <matt kowalczyk gmail com>
- To: gtk-list gnome org
- Subject: lasso tool
- Date: Mon, 11 Aug 2008 11:57:00 -0700
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!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]