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.
Hello all, apologies - forgot to cc the list. Regards, Jim. -----Original Message----- From: Jim Koutsovasilis Sent: Tuesday, July 18, 2006 11:08 AM To: 'Stuart Maclean' Subject: RE: transparent images using visad? Hello Stuart, I haven't used VisAD in a while, but I remember that you need to add a Display.Alpha scalar map to the display - this scalar map would then map the alpha-values of your image to transparency on the screen. Can you include the VisAD code you are using to add the scalar maps to the 2D display? Regards, Jim. -----Original Message----- From: owner-visad@xxxxxxxxxxxxxxxx [mailto:owner-visad@xxxxxxxxxxxxxxxx] On Behalf Of Stuart Maclean Sent: Tuesday, July 18, 2006 10:53 AM To: visad@xxxxxxxxxxxxxxxx Subject: transparent images using visad? I am trying to use visad in a web app (Java servlets) to produce transparent png responses. I build the DisplayImplJ2D in OFFSCREEN mode. I serialize to png using the javax.imageio.ImageIO routines. For now, the only data is a UnionSet of points, representing a 'route'. 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 ======================================================================= ====== ============================================================================== To unsubscribe visad, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
visad
archives: