Graphics::D rawImage(Image*,constRectF&) メソッド (gdiplusgraphics.h)

Graphics::D rawImage メソッドはイメージを描画します。

構文

Status DrawImage(
  [in]      Image         *image,
  [in, ref] const RectF & rect
);

パラメーター

[in] image

種類: イメージ*

ソース イメージを指定する Image オブジェクトへのポインター。

[in, ref] rect

型: const RectF

イメージの描画領域を境界とする四角形への参照。

戻り値

種類: 状態

メソッドが成功した場合は、Status 列挙の要素である Ok を返します

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

注釈

イメージは、四角形に合わせてスケーリングされます。

次の例では、サイズ変更されたイメージをバインドする四角形であるソース イメージを描画し、四角形に合わせてサイズ変更されたイメージを描画します。

VOID Example_DrawImage10(HDC hdc)

{
   Graphics graphics(hdc);

   // Create an Image object.
   Image image(L"climber.jpg");

   // Create a Pen object.
   Pen pen (Color(255, 255, 0, 0), 2);

   // Draw the original source image.
   graphics.DrawImage(&image, 10, 10);

   // Create a RectF object that specifies the destination of the image.
   RectF destRect(200, 50, 150, 75);

   // Draw the rectangle that bounds the image.
   graphics.DrawRectangle(&pen, destRect);

   // Draw the image.
   graphics.DrawImage(&image, destRect);
}

次の図は、前のコードの出力を示しています。

同じ画像の 2 つのバージョンを示す図。2 つ目は、1 つ目よりも少し狭く、はるかに短く、赤で囲まれています

要件

要件
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdiplusgraphics.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

こちらもご覧ください

画像の描画、配置、およびクローン作成

グラフィックス

Image

ビットマップの読み込みと表示

RectF