I've been reading the StreamingRenderer trying to understand how the
layer's drawing process works.

When the StreamingRenderer draws the layer[1] it uses the
Graphics2D.drawImage method. Wouldn't be better to use the
Graphics2D.drawRenderedImage to apply the transformation (and get better
performance?).

Who is the developer of StreamingRenderer?

[1]
-- start code StreamingRenderer code (line 1585)

// graphics.setTransform( new AffineTransform() );
for (int t = 0; t < n_lfts; t++) {
        if (fts_array[t].myImage != null) // this is the case for the
                                          // first one (ie.
                                          // fts_array[t].graphics ==
                                          // graphics)
        {
                graphics.drawImage(fts_array[t].myImage, 0, 0, null);
                fts_array[t].myImage.flush();
                fts_array[t].graphics.dispose();
        }
}

-- end code



On mar, 2007-12-11 at 13:50 -0800, Jody Garnett wrote:
> 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.
> >   
> 
-- 
Diego Fdez. Durán <[EMAIL PROTECTED]> | http://www.goedi.net
GPG : 925C 9A21 7A11 3B13 6E43 50DB F579 D119 90D2 66BB

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

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