ArcGIS和ArcEngine导出地图时,png格式支持背景透明

1、ArcGIS支持导出PNG,背景透明

导出png时,背景色和透明色不能设置为空,必须设置为同一个颜色,通常使用白色。

2、ArcEngine支持导出PNG,背景透明

                    //1.创建export
                    IExport pExport = new ExportPNGClass();
                    if (pExport is IWorldFileSettings)
                    {
                        //(pExport as IWorldFileSettings).OutputWorldFile = true;
                    }
                    if (pExport is IExportImage)
                    {
                        IExportImage pExportImage = pExport as IExportImage;
                        pExportImage.ImageType = esriExportImageType.esriExportImageTypeTrueColor;
                        if (mp.Transparent)
                        {
                            var backgroundcolor = new RgbColorClass() { Red = 255, Green = 255, Blue = 255 };
                            (pExport as IExportImage).BackgroundColor = backgroundcolor;
                        }
                    }
                    if (pExport is IExportPNG)
                    {
                        var pExportPng = pExport as IExportPNG;
                        if (mp.Transparent)
                        {
                            var transparentcolor = new RgbColorClass() { Red = 255, Green = 255, Blue = 255 };
                            (pExport as IExportPNG).TransparentColor = transparentcolor;
                        }
                    }

 

posted @ 2022-04-22 10:36  SimpleGIS  阅读(1785)  评论(0编辑  收藏  举报