Hi,

[EMAIL PROTECTED] wrote:
In simplified terms, I have a situation where I am drawing a large filled Rectangle and 
then drawing other smaller filled rectangles in front of or on top of the large one.  The 
rectangles at the front do not completely cover the large rectangle at the back so there 
is a region of the back rectangle around the smaller rectangles that "shows 
through" so to speak.

The question is, is it possible (perhaps with some form of "negative" clipping) 
to repaint the background colour of the large rectangle without having to repaint the 
smaller rectangles as well?  So, just the area that shows through from the large 
rectangle is repainted.  At the moment, I have to repaint the large rectangle and then 
all the smaller ones as well which is clearly too expensive.

  First of all, did you determine (by profiling and such) that it
  is expensive or is this your gut feeling? It is important
  to work with correct data, and sometimes our
  assumptions about performance implications may be
  incorrect (I get this stuff wrong all the time).

  Anyway, assuming that it is super-expensive to repaint
  the whole thing, you can construct a clip shape
  (which would be your bg rectangle minus your small
  rectangles) and set it on the graphics context.
  That way the area of the bg rectangle which isn't
  covered by smaller rectangles only will be repainted.

  Shape clip may be an expensive operation, though
  (depending on the pipeline), so I would still
  suggest to profile (or just time) both
  approaches.

  Thanks,
    Dmitri

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to