共用方式為


Matrix.TransformPoints(Point*, INT) method

Applies to: desktop apps only

The Matrix::TransformPoints method multiplies each point in an array by this matrix. Each point is treated as a row matrix. The multiplication is performed with the row matrix on the left and this matrix on the right.

Syntax

Status TransformPoints(
  [in, out]  Point *pts,
  [in]       INT count
);

Parameters

  • pts [in, out]
    Type: Point*

    Pointer to an array of Point objects that, on input, contains the points to be transformed and, on output, receives the transformed points. Each point in the array is transformed (multiplied by this matrix) and updated with the result of the transformation.

  • count [in]
    Type: INT

    Optional. Integer that specifies the number of points to be transformed. The default value is 1.

Return value

Type:

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.

Examples

The following example creates an array of five points and then transforms those points by calling the Matrix::TransformPoints method of a Matrix object. The code passes the array of points to the DrawCurve Methods method before the transformation and again after the transformation.

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

   Point points[5] = {
      Point(50, 100), 
      Point(100, 50),
      Point(150, 125),
      Point(200, 100),
      Point(250, 150)};

   Matrix matrix(1.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f);

   graphics.DrawCurve(&pen, points, 5);
   matrix.TransformPoints(points, 5);
   graphics.DrawCurve(&pen, points, 5); 
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusmatrix.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Matrix

Point

TransformPoints Methods

TransformVectors Methods

Transformations

Global and Local Transformations

Matrix Representation of Transformations

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012