6 * This file is part of the w32api package.
8 * THIS SOFTWARE IS NOT COPYRIGHTED
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 #ifndef _GDIPLUSMATRIX_H
20 #define _GDIPLUSMATRIX_H
22 class Matrix
: public GdiplusBase
27 Matrix(const RectF
&rect
, const PointF
*dstplg
)
29 status
= DllExports::GdipCreateMatrix3(&rect
, dstplg
, &matrix
);
32 Matrix(const Rect
&rect
, const Point
*dstplg
)
34 status
= DllExports::GdipCreateMatrix3I(&rect
, dstplg
, &matrix
);
39 status
= DllExports::GdipCreateMatrix(&matrix
);
42 Matrix(REAL m11
, REAL m12
, REAL m21
, REAL m22
, REAL dx
, REAL dy
)
44 status
= DllExports::GdipCreateMatrix2(m11
, m12
, m21
, m22
, dx
, dy
, &matrix
);
49 Matrix
*cloneMatrix
= new Matrix(); // FIXME: Matrix::matrix already initialized --> potential memory leak
50 cloneMatrix
->status
= DllExports::GdipCloneMatrix(matrix
, cloneMatrix
? &cloneMatrix
->matrix
: NULL
);
56 DllExports::GdipDeleteMatrix(matrix
);
59 BOOL
Equals(const Matrix
* matrix
)
62 SetStatus(DllExports::GdipIsMatrixEqual(this->matrix
, matrix
? matrix
->matrix
: NULL
, &result
));
66 Status
GetElements(REAL
*m
) const
68 return SetStatus(DllExports::GdipGetMatrixElements(matrix
, m
));
71 Status
GetLastStatus(VOID
)
78 return SetStatus(DllExports::GdipInvertMatrix(matrix
));
84 SetStatus(DllExports::GdipIsMatrixIdentity(matrix
, &result
));
88 BOOL
IsInvertible(VOID
)
91 SetStatus(DllExports::GdipIsMatrixInvertible(matrix
, &result
));
95 Status
Multiply(const Matrix
*matrix
, MatrixOrder order
)
97 return SetStatus(DllExports::GdipMultiplyMatrix(this->matrix
, matrix
? matrix
->matrix
: NULL
, order
));
112 return NotImplemented
;
115 Status
Rotate(REAL angle
, MatrixOrder order
)
117 return SetStatus(DllExports::GdipRotateMatrix(matrix
, angle
, order
));
120 Status
RotateAt(REAL angle
, const PointF
¢er
, MatrixOrder order
)
122 return NotImplemented
;
125 Status
Scale(REAL scaleX
, REAL scaleY
, MatrixOrder order
)
127 return SetStatus(DllExports::GdipScaleMatrix(matrix
, scaleX
, scaleY
, order
));
130 Status
SetElements(REAL m11
, REAL m12
, REAL m21
, REAL m22
, REAL dx
, REAL dy
)
132 return SetStatus(DllExports::GdipSetMatrixElements(matrix
, m11
, m12
, m21
, m22
, dx
, dy
));
135 Status
Shear(REAL shearX
, REAL shearY
, MatrixOrder order
)
137 return SetStatus(DllExports::GdipShearMatrix(matrix
, shearX
, shearY
, order
));
140 Status
TransformPoints(Point
*pts
, INT count
)
142 return SetStatus(DllExports::GdipTransformMatrixPointsI(matrix
, pts
, count
));
145 Status
TransformPoints(PointF
*pts
, INT count
)
147 return SetStatus(DllExports::GdipTransformMatrixPoints(matrix
, pts
, count
));
150 Status
TransformVectors(Point
*pts
, INT count
)
152 return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(matrix
, pts
, count
));
155 Status
TransformVectors(PointF
*pts
, INT count
)
157 return SetStatus(DllExports::GdipVectorTransformMatrixPoints(matrix
, pts
, count
));
160 Status
Translate(REAL offsetX
, REAL offsetY
, MatrixOrder order
)
162 return SetStatus(DllExports::GdipTranslateMatrix(matrix
, offsetX
, offsetY
, order
));
166 mutable Status status
;
169 Status
SetStatus(Status status
) const
173 this->status
= status
;
178 #endif /* _GDIPLUSMATRIX_H */