Title: Message
Hello,
 
I am displaying a BufferedImage in a JPanel and have some questions on performance.
 
I use the AffineTransform to scale and translate the BufferedImage in the panel.
 
I also allow the user to draw on top of the image by dragging the mouse (something like a paint program). So as the user draws on top of the image, I need to keep calling repaint() on the panel to update the image and the user's drawing.
 
What I find is this:
 
A. When my panel is relatively small (for example an 8th of total screen area) and when the image is not scaled up (fits entirely within the panel), I get good performance. That is, the user's drawing keeps up with the motion of the mouse in the panel.
 
B. When the panel is relatively large (say half as large as the screen itself) and when the image is scaled way up so that it does not fit within panel (say five times the size of the panel itself), performance is very poor. By this I mean that the user's drawing on top of the image lags significantly behind the movement of the mouse.
 
All of my rendering is done inside of the panel's paintComponent(...) method.
 
This is how I draw the image:
 
g2d.drawImage(theImage.getBufferedImage(), 0, 0, null);
 
Also, I am not setting a clipping area.
 
At this point I'm looking for some general advice on how to improve performance. I'm guessing that this would involve setting a clipping region.
 
If so can some one give some specific pointers on how to set the proper clipping region when AffineTransform has been used to scale and pan the image so that the image is much larger than the panel itself.
 
Thank you,
 
Ted Hill
=========================================================================== 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