Graphics::DrawImage(Image*,constPointF*,INT) method (gdiplusgraphics.h)
The Graphics::DrawImage method draws an image.
Syntax
Status DrawImage(
[in] Image *image,
[in] const PointF *destPoints,
[in] INT count
);
Parameters
[in] image
Type: Image*
Pointer to an Image object that specifies the source image.
[in] destPoints
Type: const PointF*
Pointer to an array of PointF objects that specify the area, in a parallelogram, in which to draw the image.
[in] count
Type: INT
Integer that specifies the number of elements in the destPoints array.
Return value
Type: Status
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Remarks
The value of the count parameter must equal 3 to specify the coordinates of the upper-left corner, upper-right corner, and lower-left corner of the parallelogram. The coordinate of the lower-right corner is calculated using the three given coordinates, the width, and the height of the image. The image is scaled to fit the parallelogram.
Examples
The following example draws an image.
VOID Example_DrawImage3(HDC hdc)
{
Graphics graphics(hdc);
// Create an Image object.
Image image(L"climber.jpg");
// Create an array of PointF objects that specify the destination of the image.
PointF destPoints[3] = {
PointF(30.0f, 30.0f),
PointF(250.0f, 50.0f),
PointF(175.0f, 120.0f)};
PointF* pdestPoints = destPoints;
// Draw the image.
graphics.DrawImage(&image, pdestPoints, 3);
}
The following illustration shows the output of the preceding code.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | gdiplusgraphics.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |
See also
Drawing, Positioning, and Cloning Images