Bitmap.Clone(const RectF, PixelFormat) method
Applies to: desktop apps only
The Bitmap::Clone method creates a new Bitmap object by copying a portion of this bitmap.
Syntax
Bitmap* Clone( [in, ref] const RectF &rect, [in] PixelFormat format );
Parameters
- rect [in, ref]
-
Type: const RectF
Reference to a rectangle that specifies the portion of this bitmap to be copied.
- format [in]
-
Type: PixelFormat
Integer that specifies the pixel format of the new bitmap. The PixelFormat data type and constants that represent various pixel formats are defined in Gdipluspixelformats.h. For more information about pixel format constants, see Image Pixel Format Constants.
Return value
Type:
Type: Bitmap*
This method returns a pointer to the new Bitmap object.
Examples
The following example creates a Bitmap object from an image file, clones the upper-left portion of the image, and then draws the cloned image.
VOID Example_Clone2(HDC hdc)
{
Graphics graphics(hdc);
// Create a Bitmap object from an image file.
Bitmap bitmap(L"Climber.jpg");
// Clone a portion of the bitmap.
RectF rect(0.0f, 0.0f, 100.0f, 100.0f);
Bitmap* clone = bitmap.Clone(rect, PixelFormatDontCare);
// Draw the clone.
graphics.DrawImage(clone, 0, 0);
delete clone;
}
Requirements
|
Minimum supported client | Windows XP, Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Product | GDI+ 1.0 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Bitmap
- Bitmap Constructors
- Clone
- Image
- Image Pixel Format Constants
- Rect
- Using Images, Bitmaps, and Metafiles
- Images, Bitmaps, and Metafiles
Send comments about this topic to Microsoft
Build date: 3/6/2012