[EMAIL PROTECTED] wrote:
Hi Dmitri,

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).

I have not officially profiled it but it is visibly slower than I would like.

  I'd still suggest to profile - you may be solving
  a symptom instead of the cause.


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.

Yes, but how do I remove areas from a clip region?  I can only see how to set a 
clip region to a Shape and the area around the smaller rectangles is not a 
Shape.


  Something along these lines
   Area clip = new Area(new Rectangle(0,0,largeRectW,largeRectH));
   clip.subtract(new Area(new Rectangle(,,,)));
   g2d.clip(clip);

  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