Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Image.Clone method

Applies to: desktop apps only

The Image::Clone method creates a new Image object and initializes it with the contents of this Image object.

Syntax

Image* Clone();

Parameters

This method has no parameters.

Return value

Type:

Type: Image*

This method returns a pointer to the new Image object.

Examples

The following example creates an Image object based on a JPEG file. The code creates a second Image object by cloning the first. Then the code calls the DrawImage method twice to draw the two images.


VOID Example_Clone(HDC hdc)
{
   Graphics graphics(hdc);

   // Create an Image object, and then clone it.
   Image image1(L"Crayons.jpg");
   Image* pImage2 = image1.Clone();

   // Draw the original image and the cloned image.
   graphics.DrawImage(&image1, 20, 20);
   graphics.DrawImage(pImage2, 250, 20);

   delete pImage2;
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Image
Bitmap
Image::FromFile
Image::FromStream
Image Constructors
Loading and Displaying Bitmaps
Drawing, Positioning, and Cloning Images

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show: