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 | |
---|---|---|
Bitmap(array<Byte> [] () [] [], Bitmap. . :: . .BitmapImageType) | Initializes a new instance of the Bitmap class with the specified image data and type. | |
Bitmap(Int32, Int32) | Initializes a new instance of the Bitmap class with the specified height and width. |
Top
Properties
Name | Description | |
---|---|---|
Height | Gets the height of the current bitmap. | |
Width | Gets the width of the current bitmap. |
Top
Methods
Name | Description | |
---|---|---|
Clear | Clears the entire drawing surface. | |
Dispose | Releases resources. | |
DrawEllipse(Color, Int32, Int32, Int32, Int32) | Draws a filled ellipse on the display device. | |
DrawEllipse(Color, Int32, Int32, Int32, Int32, Int32, Color, Int32, Int32, Color, Int32, Int32, UInt16) | Draws an ellipse filled with a specified color gradient. | |
DrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32) | Draws a rectangular block of pixels on the display device. | |
DrawImage(Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16) | Draws a rectangular block of pixels with a specified degree of transparency. | |
DrawLine | Draws a line on the display device. | |
DrawRectangle | Draws a rectangle on the display device. | |
DrawText | Draws text on the display device, using a specified font and color. | |
DrawTextInRect(String, Int32, Int32, Int32, Int32, UInt32, Color, Font) | Draws text in a specified rectangle. | |
DrawTextInRect(String%, Int32%, Int32%, Int32, Int32, Int32, Int32, UInt32, Color, Font) | Draws text in a specified rectangle. | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Flush() () () () | Flushes the current bitmap to the display device. | |
Flush(Int32, Int32, Int32, Int32) | Flushes the current bitmap to the display device. | |
GetBitmap | ||
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetPixel | Retrieves the pixel color at a specified location on the display device. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MakeTransparent | Sets a bitmap's transparent color. | |
RotateImage | Rotates an image. | |
Scale9Image | Scales an image. | |
SetClippingRectangle | Sets the clipping region (clipping rectangle) of a bitmap with a specified coordinate pair (x,y), width, and height. | |
SetPixel | Sets the color for a specified pixel. | |
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. | |
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. | |
TileImage | Tiles an image. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Fields
Name | Description | |
---|---|---|
BLACKNESS | Fills the destination rectangle with the color associated with index number 0 in the physical palette. | |
CenterX | Represents the x-coordinate location of the center of the display device, in pixels. | |
CenterY | Represents the y-coordinate location of the center of the display device, in pixels. | |
DSTDKGRAY | Fills the destination rectangle with a dark gray color. | |
DSTGRAY | Fills the destination rectangle with a gray color. | |
DSTINVERT | Inverts the destination rectangle. | |
DSTLTGRAY | Fills the destination rectangle with a light gray color. | |
DT_AlignmentCenter | Specifies that text is center-aligned as it flows around a bitmap. | |
DT_AlignmentLeft | Specifies that text is left-aligned as it flows around a bitmap. | |
DT_AlignmentMask | Specifies that you can use a mask to get or set text alignment around a bitmap. | |
DT_AlignmentRight | Specifies that text is right-aligned as it flows around a bitmap. | |
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. | |
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. | |
DT_None | Specifies that there are no format rules. | |
DT_TrimmingCharacterEllipsis | Obsolete. Please do not use in new applications. | |
DT_TrimmingMask | Obsolete. Please do not use in new applications. | |
DT_TrimmingNone | Obsolete. Please do not use in new applications. | |
DT_TrimmingWordEllipsis | Obsolete. Please do not use in new applications. | |
DT_TruncateAtBottom | Specifies that if the bitmap text is larger than the space provided, the text is truncated at the bottom. | |
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. | |
MaxHeight | Specifies the maximum height of the display device, in pixels. | |
MaxWidth | Specifies the maximum width of the display device, in pixels. | |
OpacityOpaque | Specifies that the current bitmap is opaque. | |
OpacityTransparent | Specifies that the current bitmap is transparent. | |
PATINVERT | Inverts the source rectangle. | |
RANDOM | Fills the destination rectangle or circle with a randomly generated pattern. | |
SINGLEPIXEL | Specifies that a circle should have only a single-pixel border and no fill pattern or color. | |
SRCCOPY | Copies the source rectangle directly to the destination rectangle. | |
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.