Bitmap Class

Encapsulates a bitmap, which consists of the pixel data for a graphics image and its methods and attributes.

Namespace: Microsoft.SPOT
Assembly: Microsoft.SPOT.Graphics (in microsoft.spot.graphics.dll)

Syntax

 public sealed class Bitmap : MarshalByRefObject

Remarks

This class cannot be inherited.

The .NET Micro Framework provides the Microsoft.SPOT.Bitmap class for backward compatibility with existing applications. However, this class is not supported for new applications, and you should not use it in your .NET Micro Framework programs. Instead, the framework now provides the Windows Presentation Foundation in the following namespaces:

  • Microsoft.SPOT.Input
  • Microsoft.SPOT.Presentation
  • Microsoft.SPOT.Presentation.Controls
  • Microsoft.SPOT.Presentation.Media
  • Microsoft.SPOT.Presentation.Shapes

The .NET Micro Framework currently provides support for the following bitmap types.

  • 1bpp Indexed
  • 24bpp RGB
  • 32bpp RGB
  • 48bpp RGB
  • 16bpp RGB 555 (five bits for each color, one bit unused)
  • 16bpp RGB 556 (five bits each for red and blue, six bits for green)

If you add a bitmap to a resource file, your project must reference the assemblies Microsoft.SPOT.Graphics.dll and Microsoft.SPOT.TinyCore.dll.

If a bitmap is embedded as a resource, and its BitmapImageType is Bmp, then the Bitmap object is read-only, and attempts to modify it will throw an exception. You must make a copy of it using Bitmap.DrawImage, and modify the copy, as shown in the following code:

        Bitmap bmpMyBitmap = Resources.GetBitmap(Resources.BitmapResources.MyBitmap);
        Bitmap bmpCopy = new Bitmap(bmpMyBitmap.Width, bmpMyBitmap.Height);
        // copy the bitmap
        bmpCopy.DrawImage(0, 0, bmpMyBitmap, 0, 0, bmpMyBitmap.Width, bmpMyBitmap.Height);
        // now you may modify the copy using any Bitmap method
        bmpCopy.MakeTransparent(Microsoft.SPOT.Presentation.Media.Color.White);
      

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Bitmap Members
Microsoft.SPOT Namespace