Gets a Bitmap representing a scaled version of the Raster.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public Bitmap GetBitmap(
	int width,
	int height
)
Visual Basic (Declaration)
Public Function GetBitmap ( _
	width As Integer, _
	height As Integer _
) 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.

Return Value

A Bitmap object which represents a scaled version of the Raster.

Remarks

Any unfilled areas of the Bitmap are set to a System.Drawing.Color.Transparent color.

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")

See Also