mvillemontesrifrance-fr-esridist

How to display PNG to container with transparent background ?

Discussion created by mvillemontesrifrance-fr-esridist Employee on Feb 12, 2014
Latest reply on Mar 12, 2014 by mvillemontesrifrance-fr-esridist
Hi,

I'm trying to incorporate a PNG image to a container.
This image has a transparent background but when I add it to the container it becomes white. Any idea what can do such thing ?

My code is looking something like this :

IPageLayout pageLayout = ((MapServer)mapserver).getPageLayout();
IGraphicsContainer container = (IGraphicsContainer) pageLayout;

PngPictureElement pngPicElem = (PngPictureElement) this.currentRequestServerContext.createObject(PngPictureElement.getClsid());
pngPicElem.importPictureFromFile(imgResult.getURL());

container.addElement(pngPicElem, 0);


I have tried to manually set the background of my element but with no success :

IColor color = (IColor) (this.currentRequestServerContext.createObject(RgbColor.getClsid()));
color.setTransparency((byte) 0);
color.setRGB(0xFF0000);
          
SymbolBackground symbBg = (SymbolBackground) this.currentRequestServerContext.createObject(SymbolBackground.getClsid());
symbBg.setColor(color);
pngPicElem.setBackground(symbBg);


Thank you.

N.B. I'm using Java ArcObjects SDK on ArcGIS Server 10

Outcomes