Graphics::TransformPoints(CoordinateSpace,CoordinateSpace,PointF*,INT) メソッド (gdiplusgraphics.h)

Graphics::TransformPoints メソッドは、ある座標空間から別の座標空間にポイントの配列を変換します。 変換は、この Graphics オブジェクトの現在のワールド変換とページ変換に基づいています。

構文

Status TransformPoints(
  [in]      CoordinateSpace destSpace,
  [in]      CoordinateSpace srcSpace,
  [in, out] PointF          *pts,
  [in]      INT             count
);

パラメーター

[in] destSpace

種類: CoordinateSpace

変換先の座標空間を指定する CoordinateSpace 列挙体の要素。

[in] srcSpace

種類: CoordinateSpace

ソース座標空間を指定する CoordinateSpace 列挙体の要素。

[in, out] pts

種類: ポイント*

入力時に変換するポイントを保持し、出力時に変換されたポイントを保持する配列へのポインター。

[in] count

型: INT

pts 配列内の要素の数を指定する整数。

戻り値

種類: 状態

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

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

解説

ワールド変換は、ワールド座標空間からページ座標空間にポイントを変換します。 ページ変換は、ポイントをページ座標空間からデバイス座標空間に変換します。 座標空間の詳細については、「 座標系の種類」を参照してください。

次の例では 、Graphics オブジェクトを作成し、そのワールド変換を右に 40 単位、30 単位下に設定します。 次に、ポイントの配列を作成し、その配列のアドレスを同じ Graphics オブジェクトの Graphics::TransformPoints メソッドに渡します。 配列内のポイントは、 Graphics オブジェクトのワールド変換によって変換されます。 このコードでは 、Graphics::D rawLine メソッドを 2 回呼び出します。1 回は変換前の 2 つのポイントを接続し、1 回は変換後に 2 つのポイントを接続します。

VOID Example_TransformPoints(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 255));

   // Create an array of two Point objects.
   Point points[2] = {Point(0, 0), Point(100, 50)};

   // Draw a line that connects the two points.
   // No transformation has been performed yet.
   graphics.DrawLine(&pen, points[0], points[1]);

   // Set the world transformation of the Graphics object.
   graphics.TranslateTransform(40.0f, 30.0f);

   // Transform the points in the array from world to page coordinates.
   graphics.TransformPoints(
      CoordinateSpacePage, 
      CoordinateSpaceWorld, 
      points, 
      2);

   // It is the world transformation that takes points from world
   // space to page space. Because the world transformation is a
   // translation 40 to the right and 30 down, the
   // points in the array are now (40, 30) and (140, 80).

   // Draw a line that connects the transformed points.
   graphics.ResetTransform();
   graphics.DrawLine(&pen, points[0], points[1]);
}

要件

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

関連項目

グラフィックス

Graphics::GetTransform

Graphics::MultiplyTransform

Graphics::ResetTransform

Graphics::RotateTransform

Graphics::ScaleTransform

Graphics::SetTransform

Graphics::TranslateTransform

マトリックス

MatrixOrder

変換

座標系の種類