Bitmap Class

The Bitmap class inherits from the Image class. The Image class provides methods for loading and saving vector images (metafiles) and raster images (bitmaps). The Bitmap class expands on the capabilities of the Image class by providing additional methods for creating and manipulating raster images.

Syntax

class Bitmap

Inheritance

This class inherits from the Image class.

Members Table

The following table lists the members exposed by the Bitmap object.

Constructors

ConstructorDescription
Bitmap::Bitmap(IDirectDrawSurface7*) Creates a Bitmap object based on a DirectDraw surface. The Bitmap object maintains a reference to the DirectDraw surface until the Bitmap object is deleted or goes out of scope.
Bitmap::Bitmap(INT,INT,Grpaphics*) Creates a Bitmap object based on a Graphics object, a width, and a height.
Bitmap::Bitmap(BITMAPINFO*,VOID*) Creates a Bitmap object based on a BITMAPINFO structure and an array of pixel data.
Bitmap::Bitmap(INT,INT,PixelFormat) Creates a Bitmap object of a specified size and pixel format. The pixel data must be provided after the Bitmap object is constructed.
Bitmap::Bitmap(HBITMAP,HPALETTE) Creates a Bitmap object based on a handle to a Windows Microsoft Windows Graphics Device Interface (GDI) bitmap and a handle to a GDI palette.
Bitmap::Bitmap(INT,INT,INT,PixelFormat,BYTE*) Creates a Bitmap object based on an array of bytes along with size and format information.
Bitmap::Bitmap(WCHAR*,BOOL) Creates a Bitmap object based on an image file.
Bitmap::Bitmap(HINSTANCE,WCHAR*) Creates a Bitmap object based on an application or DLL instance handle and the name of a bitmap resource.
Bitmap::Bitmap(HICON) Creates a Bitmap object based on an icon.
Bitmap::Bitmap(IStream*,BOOL) Creates a Bitmap object based on an IStream COM interface.

Methods

MethodDescription
Bitmap::ApplyEffect(Bitmap*,INT,Effect*,RECT*,RECT*,Bitmap*) The ApplyEffect method creates a new Bitmap object by applying a specified effect to an existing Bitmap object.
Bitmap::ApplyEffect(Effect*,RECT*) The ApplyEffect method alters this Bitmap object by applying a specified effect.
Bitmap::Clone(Rect&,PixelFormat) The Clone method creates a new Bitmap object by copying a portion of this bitmap.
Bitmap::Clone(RectF&,PixelFormat) The Clone method creates a new Bitmap object by copying a portion of this bitmap.
Bitmap::Clone(REAL,REAL,REAL,REAL,PixelFormat) The Clone method creates a new Bitmap object by copying a portion of this bitmap.
Bitmap::Clone(INT,INT,INT,INT,PixelFormat) The Clone method creates a new Bitmap object by copying a portion of this bitmap.
Bitmap::ConvertFormat The ConvertFormat method converts a bitmap to a specified pixel format. The original pixel data in the bitmap is replaced by the new pixel data.
Bitmap::FromBITMAPINFO The FromBITMAPINFO method creates a Bitmap object based on a BITMAPINFO structure and an array of pixel data.
Bitmap::FromDirectDrawSurface7 The FromDirectDrawSurface7 method creates a Bitmap object based on a DirectDraw surface. The Bitmap object maintains a reference to the DirectDraw surface until the Bitmap object is deleted.
Bitmap::FromFile The FromFile method creates a Bitmap object based on an image file.
Bitmap::FromHBITMAP The FromHBITMAP method creates a Bitmap object based on a handle to a Windows GDI bitmap and a handle to a GDI palette.
Bitmap::FromHICON The FromHICON method creates a Bitmap object based on a handle to an icon.
Bitmap::FromResource The FromResource method creates a Bitmap object based on an application or DLL instance handle and the name of a bitmap resource.
Bitmap::FromStream The FromStream method creates a Bitmap object based on a stream.
Bitmap::GetHBITMAP The GetHBITMAP method creates a GDI bitmap from this Bitmap object.
Bitmap::GetHICON The GetHICON method creates an icon from this Bitmap object.
Bitmap::GetHistogram The GetHistogram method returns one or more histograms for specified color channels of this Bitmap object.
Bitmap::GetHistogramSize The GetHistogramSize returns the number of elements (in an array of UINTs) that you must allocate before you call the GetHistogram method of a Bitmap object.
Bitmap::GetPixel The GetPixel method gets the color of a specified pixel in this bitmap.
Bitmap::InitializePalette The InitializePalette method initializes a standard, optimal, or custom color palette.
Bitmap::LockBits The LockBits method locks a rectangular portion of this bitmap and provides a temporary buffer that you can use to read or write pixel data in a specified format. Any pixel data that you write to the buffer is copied to the Bitmap object when you call UnlockBits.
Bitmap::SetPixel The SetPixel method sets the color of a specified pixel in this bitmap.
Bitmap::SetResolution The SetResolution method sets the resolution of this Bitmap object.
Bitmap::UnlockBits The UnlockBits method unlocks a portion of this bitmap that was previously locked by a call to Bitmap::LockBits.
Tags :


Community Content

Luis555
Convert Graphics to Bitmap
It's not very clear in the MSDN how to convert a graphics object to a bitmap.
This can be achieved by using the contructor.

Bitmap::Bitmap(INT width ,INT height , Graphics* g)

adurling
Typo
The overload Bitmap::Bitmap(INT,INT,Grpaphics*) seems to be a typo.
Tags :

Page view tracker