Hi all,

I am applying scale transform operator according to the zoom coefficient. But it slows dowm the rendering of my shapes considerably. I checked the Java2d archives and found couple of posts but not one had a convincing solution. I am attaching my paint method where I do the scale transformation. Can you please help me out.
Thanks,
Regards,
Rajesh
 
**************************************************************************
public synchronized void paintComponent(Graphics g) {
   super.paintComponent(g);
   g2d = (Graphics2D)g;
   if ( source == null ) {
      g2d.setColor(Color.white);
      g2d.fillRect(0, 0, 1000, 1000);
      return;
   }
   clipBounds = g2d.getClipBounds();
   transform = AffineTransform.getTranslateInstance (0,0);
   transform.scale(zoom,zoom);
   try {
      g2d.drawRenderedImage(source.getSubImage((int)(clipBounds.x/zoom),
                     (int)(clipBounds.y/zoom),(int)(clipBounds.width/zoom),
                     (int)(clipBounds.height/zoom)), transform);
      shape i;
      for(int i1 = 0; i1 < list.size(); i1++) {
         ((shape)list.get(i1)).paint(g2d);
      }
      } catch(ArrayIndexOutOfBoundsException e) {}
      g.dispose();
}
**************************************************************************


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software =========================================================================== 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