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.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .MarshalByRefObject
    Microsoft.SPOT..::..Bitmap

Namespace:  Microsoft.SPOT
Assembly:  Microsoft.SPOT.Graphics (in Microsoft.SPOT.Graphics.dll)

Syntax

'Declaration
Public NotInheritable Class Bitmap _
    Inherits MarshalByRefObject _
    Implements IDisposable
public sealed class Bitmap : MarshalByRefObject, 
    IDisposable
public ref class Bitmap sealed : public MarshalByRefObject, 
    IDisposable
[<Sealed>]
type Bitmap =  
    class
        inherit MarshalByRefObject
        interface IDisposable
    end
public final class Bitmap extends MarshalByRefObject implements IDisposable

The Bitmap type exposes the following members.

Constructors

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

Top

Properties

  Name Description
Public property Height Gets the height of the current bitmap.
Public property Width Gets the width of the current bitmap.

Top

Methods

  Name Description
Public method Clear Clears the entire drawing surface.
Public method Dispose Releases resources.
Public method DrawEllipse(Color, Int32, Int32, Int32, Int32) Draws a filled ellipse on the display device.
Public method DrawEllipse(Color, Int32, Int32, Int32, Int32, Int32, Color, Int32, Int32, Color, Int32, Int32, UInt16) Draws an ellipse filled with a specified color gradient.
Public method DrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32) Draws a rectangular block of pixels on the display device.
Public method DrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16) Draws a rectangular block of pixels with a specified degree of transparency.
Public method DrawLine Draws a line on the display device.
Public method DrawRectangle Draws a rectangle on the display device.
Public method DrawText Draws text on the display device, using a specified font and color.
Public method DrawTextInRect(String, Int32, Int32, Int32, Int32, UInt32, Color, Font) Draws text in a specified rectangle.
Public method DrawTextInRect(String%, Int32%, Int32%, Int32, Int32, Int32, Int32, UInt32, Color, Font) Draws text in a specified rectangle.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method Flush() () () () Flushes the current bitmap to the display device.
Public method Flush(Int32, Int32, Int32, Int32) Flushes the current bitmap to the display device.
Public method GetBitmap
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetPixel Retrieves the pixel color at a specified location on the display device.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method MakeTransparent Sets a bitmap's transparent color.
Public method RotateImage Rotates an image.
Public method Scale9Image Scales an image.
Public method SetClippingRectangle Sets the clipping region (clipping rectangle) of a bitmap with a specified coordinate pair (x,y), width, and height.
Public method SetPixel Sets the color for a specified pixel.
Public method StretchImage(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 method StretchImage(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 method TileImage Tiles an image.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Public fieldStatic member BLACKNESS Fills the destination rectangle with the color associated with index number 0 in the physical palette.
Public fieldStatic member CenterX Represents the x-coordinate location of the center of the display device, in pixels.
Public fieldStatic member CenterY Represents the y-coordinate location of the center of the display device, in pixels.
Public fieldStatic member DSTDKGRAY Fills the destination rectangle with a dark gray color.
Public fieldStatic member DSTGRAY Fills the destination rectangle with a gray color.
Public fieldStatic member DSTINVERT Inverts the destination rectangle.
Public fieldStatic member DSTLTGRAY Fills the destination rectangle with a light gray color.
Public fieldStatic member DT_AlignmentCenter Specifies that text is center-aligned as it flows around a bitmap.
Public fieldStatic member DT_AlignmentLeft Specifies that text is left-aligned as it flows around a bitmap.
Public fieldStatic member DT_AlignmentMask Specifies that you can use a mask to get or set text alignment around a bitmap.
Public fieldStatic member DT_AlignmentRight Specifies that text is right-aligned as it flows around a bitmap.
Public fieldStatic member DT_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 member DT_IgnoreHeight Specifies 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 member DT_None Specifies that there are no format rules.
Public fieldStatic member DT_TrimmingCharacterEllipsis Obsolete. Please do not use in new applications.
Public fieldStatic member DT_TrimmingMask Obsolete. Please do not use in new applications.
Public fieldStatic member DT_TrimmingNone Obsolete. Please do not use in new applications.
Public fieldStatic member DT_TrimmingWordEllipsis Obsolete. Please do not use in new applications.
Public fieldStatic member DT_TruncateAtBottom Specifies that if the bitmap text is larger than the space provided, the text is truncated at the bottom.
Public fieldStatic member DT_WordWrap Specifies 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 member MaxHeight Specifies the maximum height of the display device, in pixels.
Public fieldStatic member MaxWidth Specifies the maximum width of the display device, in pixels.
Public fieldStatic member OpacityOpaque Specifies that the current bitmap is opaque.
Public fieldStatic member OpacityTransparent Specifies that the current bitmap is transparent.
Public fieldStatic member PATINVERT Inverts the source rectangle.
Public fieldStatic member RANDOM Fills the destination rectangle or circle with a randomly generated pattern.
Public fieldStatic member SINGLEPIXEL Specifies that a circle should have only a single-pixel border and no fill pattern or color.
Public fieldStatic member SRCCOPY Copies the source rectangle directly to the destination rectangle.
Public fieldStatic member WHITENESS Fills the destination rectangle with the color associated with index number 1 in the physical palette.

Top

Remarks

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

Thread Safety

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

See Also

Reference

Microsoft.SPOT Namespace