Re: Trying to draw a "selection rectangle"
On Tuesday 19 August 2003 08:00 pm, Marco Antoniotti wrote:
> Can anybody see if I am missing something totally obvious?
This is probably a tangential answer since it doesn't directly address your
problem...
Selection rectangles should, in general, be drawn and undrawn using XOR
operations.
For example, if an edge of your selection rectangle intersects with some
graphic object, then clearing the rectangle will leave potholes in the object
where the rectangle has been cleared to the background colour. This is
probably why your code snippet contains a redraw of a chunk of the pinboard
layout. This approach is likely to be dog slow when you start selecting
larger areas.
The "standard" way of remembering what was underneath the selection is to XOR
the selection rectangle in, then XOR it back out again. Draw the rectangle
with XOR. To remove it, draw it again with XOR (in the same location, with
the same colours, dashed-ness, etc.).
pt
ps. Looking at the code snippet: It seems to me that the call to
gp:clear-rectangle is superfluous. You immediately redraw over top of the
cleared rectangle. Remove the clear-rectangle line and see if anything
changes (it shouldn't, unless you have calculated the bounds incorrectly
(something I do every time :-)).
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________