Graphics::DrawImage(Image,RectF,Matrix,Effect,ImageAttributes,Unit) method (gdiplusgraphics.h)

The method draws a portion of an image after applying a specified effect.


Status DrawImage(
  [in] Image           *image,
  [in] RectF           *sourceRect,
  [in] Matrix          *xForm,
  [in] Effect          *effect,
  [in] ImageAttributes *imageAttributes,
  [in] Unit            srcUnit


[in] image

Type: Image*

Pointer to an Image object that specifies the image to be drawn.

[in] sourceRect

Type: RectF*

Pointer to a RectF object that specifies the portion of the image to be drawn.

[in] xForm

Type: Matrix*

Pointer to a Matrix object that specifies the parallelogram in which the image portion is rendered. The destination parallelogram is calculated by applying the affine transformation stored in the matrix to the source rectangle.

[in] effect

Type: Effect*

Pointer to a instance of a descendant of the Effect class. The descendant specifies an effect or adjustment (for example, a change in contrast) that is applied to the image before rendering. The image is not permanently altered by the effect.

[in] imageAttributes

Type: ImageAttributes*

Pointer to an ImageAttributes object that specifies color adjustments to be applied when the image is rendered. Can be NULL.

[in] srcUnit

Type: Unit*

Element of the Unit enumeration that specifies the unit of measure for the source rectangle.

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.


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



Loading and Displaying Bitmaps