Okay; so JPanel does double buffering by default (so your paint method 
is being passed a Graphics object that is backed onto a BuferedImage - 
check it out in a debugger). Needless to say this is not what you want 
for performance...

Have a read of this:
- http://www.exampledepot.com/egs/java.awt.image/VolImage.html

Now there is a good chance I am leading you down the garden path here; 
performance tuning is a difficult balance. Please try rendering to a 
VolatileImage and let it me know if it works in your situation. I know 
it does wonders for doing the usual range of JAI activities; but 
resampling down onto disk may stretch the limits.

The source code for JAI is online; you may want to look exactly at what 
DisplayJAI is doing.
Cheers,
Jody
> I append the full source code[1] but the painting part is:
>
> private class PanelMap extends JPanel {
>
>         @Override
>         public void paint(Graphics g) {
>             try {
>                 Graphics2D g2d = (Graphics2D) g;
>                 Rectangle rectangle = new Rectangle(getSize());
>
>                 //System.out.println("Map size (px): "+ rectangle.height
> + "x" + rectangle.width);
>
>                 renderer.paint(g2d, rectangle,
> mapContext.getLayerBounds());
>             } catch (IOException ex) {
>
> Logger.getLogger(PanelGeoMap.class.getName()).log(Level.SEVERE,
> null, ex);
>             }
>         }
> }
>
> I override the JPanel's paint method. PanelMap is inside a JScrollPane
> and the renderer, in theory, only have to draw the visible viewport.
>   


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to