ReactOS  0.4.15-dev-492-ga1108f6
gdiplusmatrix.h
Go to the documentation of this file.
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  friend class GraphicsPath;
27  friend class Brush;
28  friend class LinearGradientBrush;
29  friend class TextureBrush;
30 
31  public:
32  Matrix(const RectF &rect, const PointF *dstplg)
33  {
35  }
36 
37  Matrix(const Rect &rect, const Point *dstplg)
38  {
40  }
41 
43  {
45  }
46 
48  {
50  }
51 
52  Matrix *
53  Clone() const
54  {
55  GpMatrix *cloneMatrix = NULL;
57 
58  if (lastStatus != Ok)
59  return NULL;
60 
61  Matrix *newMatrix = new Matrix(cloneMatrix);
62  if (!newMatrix)
63  DllExports::GdipDeleteMatrix(cloneMatrix);
64 
65  return newMatrix;
66  }
67 
69  {
71  }
72 
73  BOOL
74  Equals(const Matrix *matrix) const
75  {
76  BOOL result;
78  return result;
79  }
80 
81  Status
82  GetElements(REAL *m) const
83  {
85  }
86 
87  Status
88  GetLastStatus() const
89  {
90  return lastStatus;
91  }
92 
93  Status
95  {
97  }
98 
99  BOOL
100  IsIdentity() const
101  {
102  BOOL result;
104  return result;
105  }
106 
107  BOOL
108  IsInvertible() const
109  {
110  BOOL result;
112  return result;
113  }
114 
115  Status
117  {
119  }
120 
121  REAL
122  OffsetX() const
123  {
124  REAL elements[6];
125  if (GetElements(elements) == Ok)
126  return elements[4];
127  return 0.0f;
128  }
129 
130  REAL
131  OffsetY() const
132  {
133  REAL elements[6];
134  if (GetElements(elements) == Ok)
135  return elements[5];
136  return 0.0f;
137  }
138 
139  Status
141  {
142  return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
143  }
144 
145  Status
147  {
149  }
150 
151  Status
153  {
154  if (order == MatrixOrderPrepend)
155  {
158  return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, -center.X, -center.Y, order));
159  }
160  else
161  {
165  }
166  }
167 
168  Status
170  {
171  return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order));
172  }
173 
174  Status
176  {
178  }
179 
180  Status
182  {
183  return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order));
184  }
185 
186  Status
188  {
190  }
191 
192  Status
194  {
196  }
197 
198  Status
200  {
202  }
203 
204  Status
206  {
208  }
209 
210  Status
212  {
213  return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order));
214  }
215 
216  protected:
219 
221  {
222  }
223 
224  Status
226  {
227  if (status != Ok)
228  lastStatus = status;
229  return status;
230  }
231 
232  // get native
233  friend inline GpMatrix *&
235  {
236  return const_cast<Matrix *>(matrix)->nativeMatrix;
237  }
238 };
239 
240 #endif /* _GDIPLUSMATRIX_H */
GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count)
Definition: matrix.c:467
Status GetElements(REAL *m) const
Definition: gdiplusmatrix.h:82
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:316
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GpStatus WINGDIPAPI GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:445
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix)
Definition: matrix.c:61
Status Scale(REAL scaleX, REAL scaleY, MatrixOrder order=MatrixOrderPrepend)
GLuint GLenum matrix
Definition: glext.h:9407
GpStatus WINGDIPAPI GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *out)
Definition: matrix.c:172
GLuint GLuint GLsizei count
Definition: gl.h:1545
Matrix * Clone() const
Definition: gdiplusmatrix.h:53
GLint dy
Definition: linetemp.h:97
GpStatus WINGDIPAPI GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *pt, GpMatrix **matrix)
Definition: matrix.c:104
Status RotateAt(REAL angle, const PointF &center, MatrixOrder order=MatrixOrderPrepend)
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
BOOL Equals(const Matrix *matrix) const
Definition: gdiplusmatrix.h:74
Status Translate(REAL offsetX, REAL offsetY, MatrixOrder order=MatrixOrderPrepend)
Status TransformPoints(Point *pts, INT count)
GLfloat angle
Definition: glext.h:10853
Status lastStatus
Status TransformPoints(PointF *pts, INT count)
Status SetStatus(Status status) const
int32_t INT
Definition: typedefs.h:57
& rect
Definition: startmenu.cpp:1413
GpStatus WINGDIPAPI GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *pt, GpMatrix **matrix)
Definition: matrix.c:85
const GLfloat * m
Definition: glext.h:10848
BOOL IsInvertible() const
GpStatus WINGDIPAPI GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:225
friend GpMatrix *& getNat(const Matrix *matrix)
Status Invert()
Definition: gdiplusmatrix.h:94
GpStatus WINGDIPAPI GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result)
Definition: matrix.c:499
unsigned int BOOL
Definition: ntddk_ex.h:94
REAL OffsetX() const
Matrix(GpMatrix *matrix)
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
Definition: matrix.c:125
Status SetElements(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
MatrixOrder
Definition: gdiplusenums.h:186
#define m11
GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count)
Definition: matrix.c:386
#define m21
Status TransformVectors(PointF *pts, INT count)
GpMatrix * nativeMatrix
#define m22
REAL Y
Definition: gdiplustypes.h:649
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
Status Shear(REAL shearX, REAL shearY, MatrixOrder order=MatrixOrderPrepend)
BOOL IsIdentity() const
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
REAL X
Definition: gdiplustypes.h:648
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Definition: matrix.c:363
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, GpMatrixOrder order)
Definition: matrix.c:335
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Definition: matrix.c:185
Status Multiply(const Matrix *matrix, MatrixOrder order=MatrixOrderPrepend)
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
Matrix(const Rect &rect, const Point *dstplg)
Definition: gdiplusmatrix.h:37
Status GetLastStatus() const
Definition: gdiplusmatrix.h:88
#define m12
GLint dx
Definition: linetemp.h:97
Status TransformVectors(Point *pts, INT count)
Matrix(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: gdiplusmatrix.h:47
Status Reset()
REAL OffsetY() const
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:512
Definition: gdipluspen.h:22
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
Matrix(const RectF &rect, const PointF *dstplg)
Definition: gdiplusmatrix.h:32
Status Rotate(REAL angle, MatrixOrder order=MatrixOrderPrepend)
Definition: ps.c:97
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:240