Select to view content in your preferred language

Print Transparent Polygons in Graphic Layer

1624
1
08-06-2010 08:50 AM
CameronIrvine
Emerging Contributor
Hi,

I am having problems getting polygons in the graphics layer to honour the transparency when printed.  You can see from Transparent1.jpg that the polygon is selected and is transparent but when it prints the polygon is filled with black (see Transparent2.jpg).

The code (see below) currently gets the tiled image and the dynamic image sets the transparency for the dynamic layer and then merges the two.  Obviously I need to do the same for the graphics layer but I can't seem to work out how to do this.  Can anyone lead me in the right direction?

Thanks!
Cameron

//Get the map image from the server and process the mime stream

                mapdesc.TransparentColor = mapdesc.BackgroundSymbol.Color;
                MapImage mapimg = mapServer.ExportMapImage(mapdesc, imgdesc);
                Image mapImage = byteArrayToImage(mapimg.ImageData);

                MapImage mapimgTiled = mapServerTiled.ExportMapImage(mapdescTiled, imgdesc);
                Image mapImageTiled = byteArrayToImage(mapimgTiled.ImageData);

                

                //Get the scale bar image
                Image sb = GetScaleBar(mapServer, imgdisp, mapdesc);

                //Get the legend
                //
                //TODO The file loaded here needs to depend on the address of the dynamic map service passed in
                //
               

                //Get the scale
                double mapscale = mapServer.ComputeScale(mapdesc, imgdisp);

                //
                //Blend the images and graphcis to make the make
                //             
                //Need to use bitmaps for these operations
                Bitmap bmpTiled = new Bitmap(new Bitmap(mapImageTiled));
                Bitmap bmpDyno = new Bitmap(new Bitmap(mapImage));


                //Set the transparency in the top dynamiclayer image, this needs to be the 
                //background color from the ArcMap dataframe
                int intA = int.Parse(ConfigurationManager.AppSettings["transparentA"]);
                int intR = int.Parse(ConfigurationManager.AppSettings["transparentR"]);
                int intG = int.Parse(ConfigurationManager.AppSettings["transparentG"]);
                int intB = int.Parse(ConfigurationManager.AppSettings["transparentB"]);
                System.Drawing.Color cc = System.Drawing.Color.FromArgb(intA, intR, intG, intB);
                bmpDyno.MakeTransparent(cc);

                         
                //Merge the images
                System.Drawing.Graphics myGraphic = System.Drawing.Graphics.FromImage(bmpTiled); 
                myGraphic.DrawImage(bmpDyno, 0, 0);
                myGraphic.Save();
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: dubravko.antonic

I'm more Desktop oriented, but it looks to me that you've created transparency using .Net framwork on the picture instead of ArcObjects that modifies map. You've modified the picture but server still has image without transparency and when is generated image to print it sends this non transparent image. Maybe if you could somehow to trap event and override OnPaint before print begins.

Wish you good luck in solving this issue
0 Kudos