Bitmap Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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)

public sealed class Bitmap : MarshalByRefObject, 
	IDisposable

The Bitmap type exposes the following members.

  NameDescription
Public methodBitmap(array<Byte>[]()[][], Bitmap..::..BitmapImageType)Initializes a new instance of the Bitmap class with the specified image data and type.
Public methodBitmap(Int32, Int32)Initializes a new instance of the Bitmap class with the specified height and width.
Top

  NameDescription
Public propertyHeightGets the height of the current bitmap.
Public propertyWidthGets the width of the current bitmap.
Top

  NameDescription
Public methodClearClears the entire drawing surface.
Public methodDisposeReleases resources.
Public methodDrawEllipse(Color, Int32, Int32, Int32, Int32)Draws a filled ellipse on the display device.
Public methodDrawEllipse(Color, Int32, Int32, Int32, Int32, Int32, Color, Int32, Int32, Color, Int32, Int32, UInt16)Draws an ellipse filled with a specified color gradient.
Public methodDrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32)Draws a rectangular block of pixels on the display device.
Public methodDrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16)Draws a rectangular block of pixels with a specified degree of transparency.
Public methodDrawLineDraws a line on the display device.
Public methodDrawRectangleDraws a rectangle on the display device.
Public methodDrawTextDraws text on the display device, using a specified font and color.
Public methodDrawTextInRect(String, Int32, Int32, Int32, Int32, UInt32, Color, Font)Draws text in a specified rectangle.
Public methodDrawTextInRect(String%, Int32%, Int32%, Int32, Int32, Int32, Int32, UInt32, Color, Font)Draws text in a specified rectangle.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodFlush()()()()Flushes the current bitmap to the display device.
Public methodFlush(Int32, Int32, Int32, Int32)Flushes the current bitmap to the display device.
Public methodGetBitmap
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetPixelRetrieves the pixel color at a specified location on the display device.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodMakeTransparentSets a bitmap's transparent color.
Public methodRotateImageRotates an image.
Public methodScale9ImageScales an image.
Public methodSetClippingRectangleSets the clipping region (clipping rectangle) of a bitmap with a specified coordinate pair (x,y), width, and height.
Public methodSetPixelSets the color for a specified pixel.
Public methodStretchImage(Int32, Int32, Bitmap, Int32, Int32, UInt16)Draws a rectangular block of pixels on the display device, stretching or shrinking the rectangular area as necessary.
Public methodStretchImage(Int32, Int32, Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16)Draws a rectangular block of pixels on the display device, stretching or shrinking the rectangular area as necessary.
Public methodTileImageTiles an image.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberBLACKNESSFills the destination rectangle with the color associated with index number 0 in the physical palette.
Public fieldStatic memberCenterXRepresents the x-coordinate location of the center of the display device, in pixels.
Public fieldStatic memberCenterYRepresents the y-coordinate location of the center of the display device, in pixels.
Public fieldStatic memberDSTDKGRAYFills the destination rectangle with a dark gray color.
Public fieldStatic memberDSTGRAYFills the destination rectangle with a gray color.
Public fieldStatic memberDSTINVERTInverts the destination rectangle.
Public fieldStatic memberDSTLTGRAYFills the destination rectangle with a light gray color.
Public fieldStatic memberDT_AlignmentCenterSpecifies that text is center-aligned as it flows around a bitmap.
Public fieldStatic memberDT_AlignmentLeftSpecifies that text is left-aligned as it flows around a bitmap.
Public fieldStatic memberDT_AlignmentMaskSpecifies that you can use a mask to get or set text alignment around a bitmap.
Public fieldStatic memberDT_AlignmentRightSpecifies that text is right-aligned as it flows around a bitmap.
Public fieldStatic memberDT_Ellipsis Obsolete. Specifies that the bitmap text is trimmed to the nearest character, and an ellipsis is inserted at the end of each trimmed line.
Public fieldStatic memberDT_IgnoreHeightSpecifies that if the bitmap text is larger than the space provided, the text is drawn in its full size, rather than being scaled down to fit the value in the Height property.
Public fieldStatic memberDT_NoneSpecifies that there are no format rules.
Public fieldStatic memberDT_TrimmingCharacterEllipsisObsolete. Please do not use in new applications.
Public fieldStatic memberDT_TrimmingMaskObsolete. Please do not use in new applications.
Public fieldStatic memberDT_TrimmingNoneObsolete. Please do not use in new applications.
Public fieldStatic memberDT_TrimmingWordEllipsisObsolete. Please do not use in new applications.
Public fieldStatic memberDT_TruncateAtBottomSpecifies that if the bitmap text is larger than the space provided, the text is truncated at the bottom.
Public fieldStatic memberDT_WordWrapSpecifies whether a line of bitmap text automatically wraps words to the beginning of the next line when the line reaches its maximum width.
Public fieldStatic memberMaxHeightSpecifies the maximum height of the display device, in pixels.
Public fieldStatic memberMaxWidthSpecifies the maximum width of the display device, in pixels.
Public fieldStatic memberOpacityOpaqueSpecifies that the current bitmap is opaque.
Public fieldStatic memberOpacityTransparentSpecifies that the current bitmap is transparent.
Public fieldStatic memberPATINVERTInverts the source rectangle.
Public fieldStatic memberRANDOMFills the destination rectangle or circle with a randomly generated pattern.
Public fieldStatic memberSINGLEPIXELSpecifies that a circle should have only a single-pixel border and no fill pattern or color.
Public fieldStatic memberSRCCOPYCopies the source rectangle directly to the destination rectangle.
Public fieldStatic memberWHITENESSFills the destination rectangle with the color associated with index number 1 in the physical palette.
Top

This class cannot be inherited.

The .NET Micro Framework provides the Microsoft.SPOT.Bitmap class for lower-level access, such as animation. For displaying static bitmaps and hyperlinked bitmaps, use the Image control.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: