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
28 Matrix(const RectF
&rect
, const PointF
*dstplg
)
30 status
= DllExports::GdipCreateMatrix3(&rect
, dstplg
, &matrix
);
33 Matrix(const Rect
&rect
, const Point
*dstplg
)
35 status
= DllExports::GdipCreateMatrix3I(&rect
, dstplg
, &matrix
);
40 status
= DllExports::GdipCreateMatrix(&matrix
);
43 Matrix(REAL m11
, REAL m12
, REAL m21
, REAL m22
, REAL dx
, REAL dy
)
45 status
= DllExports::GdipCreateMatrix2(m11
, m12
, m21
, m22
, dx
, dy
, &matrix
);
50 Matrix
*cloneMatrix
= new Matrix(); // FIXME: Matrix::matrix already initialized --> potential memory leak
51 cloneMatrix
->status
= DllExports::GdipCloneMatrix(matrix
, cloneMatrix
? &cloneMatrix
->matrix
: NULL
);
57 DllExports::GdipDeleteMatrix(matrix
);
60 BOOL
Equals(const Matrix
* matrix
)
63 SetStatus(DllExports::GdipIsMatrixEqual(this->matrix
, matrix
? matrix
->matrix
: NULL
, &result
));
67 Status
GetElements(REAL
*m
) const
69 return SetStatus(DllExports::GdipGetMatrixElements(matrix
, m
));
72 Status
GetLastStatus(VOID
)
79 return SetStatus(DllExports::GdipInvertMatrix(matrix
));
85 SetStatus(DllExports::GdipIsMatrixIdentity(matrix
, &result
));
89 BOOL
IsInvertible(VOID
)
92 SetStatus(DllExports::GdipIsMatrixInvertible(matrix
, &result
));
96 Status
Multiply(const Matrix
*matrix
, MatrixOrder order
)
98 return SetStatus(DllExports::GdipMultiplyMatrix(this->matrix
, matrix
? matrix
->matrix
: NULL
, order
));
113 return NotImplemented
;
116 Status
Rotate(REAL angle
, MatrixOrder order
)
118 return SetStatus(DllExports::GdipRotateMatrix(matrix
, angle
, order
));
121 Status
RotateAt(REAL angle
, const PointF
¢er
, MatrixOrder order
)
123 return NotImplemented
;
126 Status
Scale(REAL scaleX
, REAL scaleY
, MatrixOrder order
)
128 return SetStatus(DllExports::GdipScaleMatrix(matrix
, scaleX
, scaleY
, order
));
131 Status
SetElements(REAL m11
, REAL m12
, REAL m21
, REAL m22
, REAL dx
, REAL dy
)
133 return SetStatus(DllExports::GdipSetMatrixElements(matrix
, m11
, m12
, m21
, m22
, dx
, dy
));
136 Status
Shear(REAL shearX
, REAL shearY
, MatrixOrder order
)
138 return SetStatus(DllExports::GdipShearMatrix(matrix
, shearX
, shearY
, order
));
141 Status
TransformPoints(Point
*pts
, INT count
)
143 return SetStatus(DllExports::GdipTransformMatrixPointsI(matrix
, pts
, count
));
146 Status
TransformPoints(PointF
*pts
, INT count
)
148 return SetStatus(DllExports::GdipTransformMatrixPoints(matrix
, pts
, count
));
151 Status
TransformVectors(Point
*pts
, INT count
)
153 return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(matrix
, pts
, count
));
156 Status
TransformVectors(PointF
*pts
, INT count
)
158 return SetStatus(DllExports::GdipVectorTransformMatrixPoints(matrix
, pts
, count
));
161 Status
Translate(REAL offsetX
, REAL offsetY
, MatrixOrder order
)
163 return SetStatus(DllExports::GdipTranslateMatrix(matrix
, offsetX
, offsetY
, order
));
167 mutable Status status
;
170 Status
SetStatus(Status status
) const
174 this->status
= status
;
179 #endif /* _GDIPLUSMATRIX_H */