[WTSAPI32][PSDK] Addendum to 27ed609a: Some of the WTS_INFO_CLASS values are NT6...
[reactos.git] / sdk / include / psdk / gdiplusmatrix.h
1 /*
2 * GdiPlusMatrix.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
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.
17 */
18
19 #ifndef _GDIPLUSMATRIX_H
20 #define _GDIPLUSMATRIX_H
21
22 class Matrix : public GdiplusBase
23 {
24 friend class Pen;
25 friend class Region;
26
27 public:
28 Matrix(const RectF &rect, const PointF *dstplg)
29 {
30 status = DllExports::GdipCreateMatrix3(&rect, dstplg, &matrix);
31 }
32
33 Matrix(const Rect &rect, const Point *dstplg)
34 {
35 status = DllExports::GdipCreateMatrix3I(&rect, dstplg, &matrix);
36 }
37
38 Matrix(VOID)
39 {
40 status = DllExports::GdipCreateMatrix(&matrix);
41 }
42
43 Matrix(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
44 {
45 status = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, &matrix);
46 }
47
48 Matrix *Clone(VOID)
49 {
50 Matrix *cloneMatrix = new Matrix(); // FIXME: Matrix::matrix already initialized --> potential memory leak
51 cloneMatrix->status = DllExports::GdipCloneMatrix(matrix, cloneMatrix ? &cloneMatrix->matrix : NULL);
52 return cloneMatrix;
53 }
54
55 ~Matrix(VOID)
56 {
57 DllExports::GdipDeleteMatrix(matrix);
58 }
59
60 BOOL Equals(const Matrix* matrix)
61 {
62 BOOL result;
63 SetStatus(DllExports::GdipIsMatrixEqual(this->matrix, matrix ? matrix->matrix : NULL, &result));
64 return result;
65 }
66
67 Status GetElements(REAL *m) const
68 {
69 return SetStatus(DllExports::GdipGetMatrixElements(matrix, m));
70 }
71
72 Status GetLastStatus(VOID)
73 {
74 return status;
75 }
76
77 Status Invert(VOID)
78 {
79 return SetStatus(DllExports::GdipInvertMatrix(matrix));
80 }
81
82 BOOL IsIdentity(VOID)
83 {
84 BOOL result;
85 SetStatus(DllExports::GdipIsMatrixIdentity(matrix, &result));
86 return result;
87 }
88
89 BOOL IsInvertible(VOID)
90 {
91 BOOL result;
92 SetStatus(DllExports::GdipIsMatrixInvertible(matrix, &result));
93 return result;
94 }
95
96 Status Multiply(const Matrix *matrix, MatrixOrder order)
97 {
98 return SetStatus(DllExports::GdipMultiplyMatrix(this->matrix, matrix ? matrix->matrix : NULL, order));
99 }
100
101 REAL OffsetX(VOID)
102 {
103 return 0;
104 }
105
106 REAL OffsetY(VOID)
107 {
108 return 0;
109 }
110
111 Status Reset(VOID)
112 {
113 return NotImplemented;
114 }
115
116 Status Rotate(REAL angle, MatrixOrder order)
117 {
118 return SetStatus(DllExports::GdipRotateMatrix(matrix, angle, order));
119 }
120
121 Status RotateAt(REAL angle, const PointF &center, MatrixOrder order)
122 {
123 return NotImplemented;
124 }
125
126 Status Scale(REAL scaleX, REAL scaleY, MatrixOrder order)
127 {
128 return SetStatus(DllExports::GdipScaleMatrix(matrix, scaleX, scaleY, order));
129 }
130
131 Status SetElements(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
132 {
133 return SetStatus(DllExports::GdipSetMatrixElements(matrix, m11, m12, m21, m22, dx, dy));
134 }
135
136 Status Shear(REAL shearX, REAL shearY, MatrixOrder order)
137 {
138 return SetStatus(DllExports::GdipShearMatrix(matrix, shearX, shearY, order));
139 }
140
141 Status TransformPoints(Point *pts, INT count)
142 {
143 return SetStatus(DllExports::GdipTransformMatrixPointsI(matrix, pts, count));
144 }
145
146 Status TransformPoints(PointF *pts, INT count)
147 {
148 return SetStatus(DllExports::GdipTransformMatrixPoints(matrix, pts, count));
149 }
150
151 Status TransformVectors(Point *pts, INT count)
152 {
153 return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(matrix, pts, count));
154 }
155
156 Status TransformVectors(PointF *pts, INT count)
157 {
158 return SetStatus(DllExports::GdipVectorTransformMatrixPoints(matrix, pts, count));
159 }
160
161 Status Translate(REAL offsetX, REAL offsetY, MatrixOrder order)
162 {
163 return SetStatus(DllExports::GdipTranslateMatrix(matrix, offsetX, offsetY, order));
164 }
165
166 private:
167 mutable Status status;
168 GpMatrix *matrix;
169
170 Status SetStatus(Status status) const
171 {
172 if (status == Ok)
173 return status;
174 this->status = status;
175 return status;
176 }
177 };
178
179 #endif /* _GDIPLUSMATRIX_H */