How to display PNG to container with transparent background ?

656
2
02-12-2014 04:16 AM
MathieuVILLEMONT1
Occasional Contributor
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
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
Transparency may not be supported, look here.
0 Kudos
MathieuVILLEMONT1
Occasional Contributor
Indeed 😞

Thanks.
0 Kudos