Share via


Graphics::D rawImage (Image*,constPointF*,INT) 方法 (gdiplusgraphics.h)

Graphics::D rawImage方法會繪製影像。

語法

Status DrawImage(
  [in] Image        *image,
  [in] const PointF *destPoints,
  [in] INT          count
);

參數

[in] image

類型: 影像*

指定來源影像之 Image 物件的指標。

[in] destPoints

類型:const PointF*

PointF物件的陣列指標,指定繪製影像之平行方塊中的區域。

[in] count

類型: INT

整數,指定 destPoints 陣列中的專案數目。

傳回值

類型: 狀態

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其中一個其他元素。

備註

count參數的值必須等於 3,才能指定平行投影左上角、右上角和左下角的座標。 右下角的座標是使用三個指定的座標、寬度和影像的高度來計算。 影像會縮放以符合平行投影。

範例

下列範例會繪製影像。

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);
}

下圖顯示上述程式碼的輸出。

此圖顯示先前已切割成平行投影的矩形影像

需求

   
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限傳統型應用程式]
最低支援的伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平台 Windows
標頭 gdiplusgraphics.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

繪製、定位和複製影像

圖形

映像

載入和顯示點陣圖