Re: followup to transparent image problem

Hi Curtis, thanks for the followup.

The quickest and dirtiest fix for me was to add the following changes, both in VisADCanvasJ2D.java. I add the 0 value for the alpha channel of the background, in the call to setBackgroundColor:


 public void setBackgroundColor(float r, float g, float b) {
          //   setBackground(new Color(r, g, b));
    setBackground(new Color(r, g, b, 0));
  }
        

The better way to go would be to offer a transparency arg along with the r,g,b in classes such as DisplayRenderer, RendererControl, but just looking through the code I can see that this is quite a few changes. Obviously my quick fix is not suitable for a release, since it hard wires all images to be transparent.

The other major change is the BufferedImage construction:

//new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

I replaced the TYPE_INT_RGB with the ARGB version in all calls to build new BufferedImages in VisADCanvasJ2D.

I am using visad in offscreen mode by the way. As I said, my changes just reflect my needs. I can well imagine there are some delicate issues in adding transparency support.

On an unrelated note, I am still planning to add an Ant build.xml to the visad distro, just havent found time so far.

Let me know if I can help further.

If you're interested, you can check out an inprogress web site, which uses visad on the back end to produce the transparent images. The actual UI is the browser.

The url is http://metoc.apl.washington.edu/glmpc/browser/routebuilding.html. For route composition, you go into 'add route mode', then clicking on the canvas builds up a 'route', just a list of joined points.


Stuart Maclean

==============================================================================
To unsubscribe visad, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================