ArcGIS Explorer Component Help |
Raster..::.GetBitmap Method (Int32, Int32, Color) |
Raster Class Example See Also |
Gets a Bitmap representing a scaled version of the Raster and which has the specified background color.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public Bitmap GetBitmap( int width, int height, Color background ) |
Visual Basic (Declaration) |
---|
Public Function GetBitmap ( _ width As Integer, _ height As Integer, _ background As Color _ ) As Bitmap |
Parameters
- width
- Type: System..::.Int32
The width of the Bitmap in pixels.
- height
- Type: System..::.Int32
The height of the Bitmap in pixels.
- background
- Type: System.Drawing..::.Color
A Color object used as the background color and which will be visible if the Bitmap is larger than the Raster or if the aspect ratios do not match.
Return Value
A Bitmap object which represents a scaled version of the Raster.Examples
The code below provides two examples of using the GetBitmap method to save a scaled version of a
file geodatabase raster to disk.
CopyC#
{ Map map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map; //Get RasterLayer which represents an aerial photo RasterLayer edinburghRasterLayer = map.FindByName("ArthursSeat") as RasterLayer; //Get the Raster Raster edinburghRaster = edinburghRasterLayer.Raster; //Example 1 - Get a bitmap of the Raster with the specified dimensions //Unfilled parts of the bitmap will be set to System.Drawing.Color.Transparent System.Drawing.Bitmap bitmapSmallNoBGColor = edinburghRaster.GetBitmap(700, 800); //Save the bitmap bitmapSmallNoBGColor.Save(@"C:\temp\edinSmallNoBG.png"); //Example 2 - Get a bitmap of the raster which has the specified dimensions //Unfilled parts of the bitmap will be dark blue. System.Drawing.Bitmap bitmapSmallBGColorSet = edinburghRaster.GetBitmap(700, 800, System.Drawing.Color.DarkBlue); //Save the bitmap bitmapSmallBGColorSet.Save(@"C:\temp\edinSmallBGSet.png"); }
CopyVB.NET
Dim myMap As Map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map 'Get RasterLayer which represents an aerial photo Dim edinburghRasterLayer As RasterLayer = DirectCast(myMap.FindByName("ArthursSeat"), RasterLayer) 'Get the Raster Dim edinburghRaster As Raster = edinburghRasterLayer.Raster 'Example 1 - Get a bitmap of the Raster with the specified dimensions 'Unfilled parts of the bitmap will be set to System.Drawing.Color.Transparent Dim bitmapSmallNoBGColor As System.Drawing.Bitmap = edinburghRaster.GetBitmap(700, 800) 'Save the bitmap bitmapSmallNoBGColor.Save("C:\temp\edinSmallNoBG.png") 'Example 2 - Get a bitmap of the raster which has the specified dimensions 'Unfilled parts of the bitmap will be dark blue. Dim bitmapSmallBGColorSet As System.Drawing.Bitmap = edinburghRaster.GetBitmap(700, 800, System.Drawing.Color.DarkBlue) 'Save the bitmap bitmapSmallBGColorSet.Save("C:\temp\edinSmallBGSet.png")