Hello,

I like to have a RenderedDynamicImageResource with a transparent background.
I tried serveral things google came up with. But none worked so far.
Let me show you what I do:

        public RenderedDynamicImageResource getCity(final Long cityId){
                RenderedDynamicImageResource image = new
RenderedDynamicImageResource(500, 570) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected boolean render(Graphics2D mapGraphic) {
                        return renderCity(mapGraphic, cityId);
                    }
                };

                return image;
            }


    protected boolean renderCity(Graphics2D mapGraphic, final Long cityId) {

           ....

            // Prepare g2 for transparency
          //one of the approches I tried... without luck


mapGraphic.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,
0.9f));
            Rectangle2D.Double rect = new Rectangle2D.Double(0, 0, 500,
                    570);
            mapGraphic.fill(rect);

           .....

          // Here I draw some shapes into the mapGraphic

           ....

         //in the end I'd like to have a png with a transparent  background
and some shapes on it
    }



If anyone can provide me with help or even a working example, that would be
greatly apreciated.

cheers
reinhard

Reply via email to