Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

How to display PNG to container with transparent background ?

$
0
0
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 :

Code:

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 :

Code:

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

Viewing all articles
Browse latest Browse all 1374

Trending Articles