followup to transparent image problem

Curtis Rueden ctrueden at wisc.edu
Fri Jul 21 14:46:34 MDT 2006


Hi Stuart,

Thanks for the pointers. I'll try to find time to work on this, but it may
be a little while. The good news is that this work is somewhat relevant to
other BufferedImage logic I need to adjust within VisAD. I'll let you know
when I've added an official API for transparent backgrounds.

-Curtis

On 7/21/06, Stuart Maclean <stuart at apl.washington.edu> wrote:
>
> 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
>


More information about the visad mailing list