Overview | Methods | This Package | All Packages
Creates a new Bitmap object.
Syntax
public Bitmap( int handle )
public Bitmap( int handle, Palette palette )
public Bitmap( Bitmap maskBitmap, Bitmap colorBitmap )
public Bitmap( int width, int height )
public Bitmap( int width, int height, Graphics gr )
public Bitmap( int width, int height, int planes, int bitsPerPixel, short bits[] )
public Bitmap( String filename )
public Bitmap( Class type, String resource )
public Bitmap( IDataStream stream )
public Bitmap( IStream stream )
public Bitmap( IPicture picture )
Parameters
handle
A Win32 handle to the bitmap on which to base this object. This handle is not owned by the Bitmap object; you are responsible for freeing it.
palette
A Palette object to use with the bitmap.
maskBitmap
A black and white bitmap mask.
colorBitmap
A Bitmap object that contains a color mask.
width
The width of the bitmap.
height
The height of the bitmap.
gr
A Graphics object with which the bitmap is compatible. For example, a Graphics object based on a printer device context rather than the screen device context.
planes
The number of planes in the bitmap.
bitsPerPixel
The number of bits used to describe each pixel in the bitmap. For example, a 256-color bitmap uses eight bits to describe the color of each pixel, while a true color bitmap generally uses 24 or 32 bits.
bits
An array that contains the bits that make up the bitmap. If you want the Bitmap object to remain uninitialized, this value should be null.
filename
The name of the file that contains the bitmap image.
type
The class used to load the bitmap resource.
resource
The resource to load.
stream
A data stream (IDataStream or com.ms.wfc.ole32.IStream) from which to load the bitmap.
picture
The com.ms.wfc.ole32.IPicture object to get the bitmap from.
Remarks
The Bitmap object defines a large variety of ways in which to create a bitmap. You can create bitmaps in memory or load them from a file, a data stream, or a resource. You can create a bitmap based on a pre-existing Win32 handle or you can create bitmaps that represent a combination of two bitmasks.
When you create a bitmap based on a Win32 handle that you have previously allocated, the Bitmap object does not assume ownership of that handle. Once the Bitmap object has been disposed of you must manually free the bitmap handle.
When you create a bitmap based on two Bitmap objects that specify transparency masks, you can use the new bitmap to draw transparently to the screen. The mask bitmap should be a black and white bitmap. Each part of the mask bitmap to be drawn transparently should be white. Each part of the color bitmap to be drawn transparently should be black.