zoukankan      html  css  js  c++  java
  • 保存为栅格图片-MapControl截图——保存ActiveView为jpg图片

     1 ///<summary>Creates a .jpg (JPEG) file from IActiveView. Default values of 96 DPI are used for the image creation.</summary>
     2 ///
     3 ///<param name="activeView">An IActiveView interface</param>
     4 ///<param name="pathFileName">A System.String that the path and filename of the JPEG you want to create. Example: "C:	emp	est.jpg"</param>
     5 /// 
     6 ///<returns>A System.Boolean indicating the success</returns>
     7 /// 
     8 ///<remarks></remarks>
     9 public System.Boolean CreateJPEGFromActiveView(ESRI.ArcGIS.Carto.IActiveView activeView, System.String pathFileName)
    10 {
    11   //parameter check
    12   if (activeView == null || !(pathFileName.EndsWith(".jpg")))
    13   {
    14     return false;
    15   }
    16   ESRI.ArcGIS.Output.IExport export = new ESRI.ArcGIS.Output.ExportJPEGClass();
    17   export.ExportFileName = pathFileName;
    18 
    19   // Microsoft Windows default DPI resolution
    20   export.Resolution = 96;
    21   ESRI.ArcGIS.Display.tagRECT exportRECT = activeView.ExportFrame;
    22   ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
    23   envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
    24   export.PixelBounds = envelope;
    25   System.Int32 hDC = export.StartExporting();
    26   activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null);
    27 
    28   // Finish writing the export file and cleanup any intermediate files
    29   export.FinishExporting();
    30   export.Cleanup();
    31 
    32   return true;
    33 }

    源:http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Create_JPEG_from_ActiveView_Snippet/004900000064000000/

  • 相关阅读:
    ffmpeg结构体以及函数介绍(三)
    FFMPEG解码流程(转)
    ffmpeg结构体以及函数介绍(一)
    摄像头视频采集压缩及传输
    bedework文档(开始简单部分)
    【实时数据库PISDK】关于PITime的悲剧
    【项目研究】自动安装并配置ODBC的思路与实现
    【读书笔记】动态链接库
    如何最快测试CPU是大端机还是小端机?
    学习编程的五条捷径
  • 原文地址:https://www.cnblogs.com/xuchen/p/5844459.html
Copyright © 2011-2022 走看看