NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I cannot get the call to DisplayImplJ2D.getImage to produce a 'transparent' image. I have replaced all calls in VisADCanvas2D which build BufferedImage of type TYPE_INT_RGB with TYPE_INT_ARGB. Maybe this could be an options in future releases (??)
When I get the BufferedImage back from the call to DisplayImplJ2D.getImage(true), it claims to have given me an ARGB type of BufferedImage (using getType()) but when I view it I get a filled in background color.
If I replace the visad code in my servlet with this, I get a nice transparent image (via the ImageIO calls):
BufferedImage br = new BufferedImage( 500, 500, BufferedImage.TYPE_INT_ARGB );
Graphics2D g = br.createGraphics(); g.setBackground( new Color( 0, 0, 0, 0 ) ); g.setColor( Color.RED ); g.clearRect( 0, 0, 500, 500 ); g.drawLine( 100, 100, 200, 200 );So some Visad code must be doing some other operation(s) to 'ruin' the transparency of the composed BufferedImage ?? I have looked in VisADCanvasJ2D somewhat but nothing is jumping out at me.
I confess I am no expert in graphics nor graphics files.BTW: The underlying approach here is to use Visad as a 'data/map server' which will produce one 'layer' of data in each image, e.g. a basemap or a route or some other plot. I am then using a web browser/Javascript's z ordering to compose the whole 'picture'. I have an app where the UI must be a browser, so i cannot go with a jnlp solution. If all goes well, I will write up the architecture and post here. As you can imagine, I am stuck w/out transparent images.
Any help gratefully appreciated Stuart ============================================================================== To unsubscribe visad, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
visad
archives: