/usr/share/mingw-w64/include/gdiplus/gdiplusmatrix.h is in mingw-w64-common 3.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | /*
* gdiplusmatrix.h
*
* GDI+ Matrix class
*
* This file is part of the w32api package.
*
* Contributors:
* Created by Markus Koenig <markus@stber-koenig.de>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __GDIPLUS_MATRIX_H
#define __GDIPLUS_MATRIX_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
#ifndef __cplusplus
#error "A C++ compiler is required to include gdiplusmatrix.h."
#endif
#define GDIP_MATRIX_PI \
3.1415926535897932384626433832795028841971693993751058209749445923078164
class Matrix: public GdiplusBase
{
friend class Graphics;
friend class GraphicsPath;
friend class LinearGradientBrush;
friend class PathGradientBrush;
friend class Pen;
friend class Region;
friend class TextureBrush;
public:
Matrix(): nativeMatrix(NULL), lastStatus(Ok)
{
lastStatus = DllExports::GdipCreateMatrix(&nativeMatrix);
}
Matrix(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy):
nativeMatrix(NULL), lastStatus(Ok)
{
lastStatus = DllExports::GdipCreateMatrix2(
m11, m12, m21, m22, dx, dy,
&nativeMatrix);
}
Matrix(const RectF& rect, const PointF *dstplg):
nativeMatrix(NULL), lastStatus(Ok)
{
lastStatus = DllExports::GdipCreateMatrix3(
&rect, dstplg, &nativeMatrix);
}
Matrix(const Rect& rect, const Point *dstplg):
nativeMatrix(NULL), lastStatus(Ok)
{
lastStatus = DllExports::GdipCreateMatrix3I(
&rect, dstplg, &nativeMatrix);
}
~Matrix()
{
DllExports::GdipDeleteMatrix(nativeMatrix);
}
Matrix* Clone() const
{
GpMatrix *cloneMatrix = NULL;
Status status = updateStatus(DllExports::GdipCloneMatrix(
nativeMatrix, &cloneMatrix));
if (status == Ok) {
Matrix *result = new Matrix(cloneMatrix, lastStatus);
if (!result) {
DllExports::GdipDeleteMatrix(cloneMatrix);
lastStatus = OutOfMemory;
}
return result;
} else {
return NULL;
}
}
BOOL Equals(const Matrix *matrix) const
{
BOOL result;
updateStatus(DllExports::GdipIsMatrixEqual(
nativeMatrix,
matrix ? matrix->nativeMatrix : NULL, &result));
return result;
}
Status GetElements(REAL *m) const
{
return updateStatus(DllExports::GdipGetMatrixElements(
nativeMatrix, m));
}
Status GetLastStatus() const
{
Status result = lastStatus;
lastStatus = Ok;
return result;
}
Status Invert()
{
return updateStatus(DllExports::GdipInvertMatrix(nativeMatrix));
}
BOOL IsIdentity() const
{
BOOL result;
updateStatus(DllExports::GdipIsMatrixIdentity(
nativeMatrix, &result));
return result;
}
BOOL IsInvertible() const
{
BOOL result;
updateStatus(DllExports::GdipIsMatrixInvertible(
nativeMatrix, &result));
return result;
}
Status Multiply(const Matrix *matrix,
MatrixOrder order = MatrixOrderPrepend)
{
return updateStatus(DllExports::GdipMultiplyMatrix(
nativeMatrix,
matrix ? matrix->nativeMatrix : NULL, order));
}
REAL OffsetX() const
{
REAL m[6];
updateStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
return m[4];
}
REAL OffsetY() const
{
REAL m[6];
updateStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
return m[5];
}
Status Reset()
{
return updateStatus(DllExports::GdipSetMatrixElements(
nativeMatrix,
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
}
Status Rotate(REAL angle, MatrixOrder order = MatrixOrderPrepend)
{
return updateStatus(DllExports::GdipRotateMatrix(
nativeMatrix, angle, order));
}
Status RotateAt(REAL angle, const PointF& center,
MatrixOrder order = MatrixOrderPrepend)
{
REAL angleRadian = angle * GDIP_MATRIX_PI / 180.0f;
REAL cosAngle = ::cos(angleRadian);
REAL sinAngle = ::sin(angleRadian);
REAL x = center.X;
REAL y = center.Y;
Matrix matrix2(cosAngle, sinAngle, -sinAngle, cosAngle,
x * (1.0f-cosAngle) + y * sinAngle,
-x * sinAngle + y * (1.0f-cosAngle));
Status status = matrix2.GetLastStatus();
if (status == Ok) {
return Multiply(&matrix2, order);
} else {
return lastStatus = status;
}
}
Status Scale(REAL scaleX, REAL scaleY,
MatrixOrder order = MatrixOrderPrepend)
{
return updateStatus(DllExports::GdipScaleMatrix(
nativeMatrix, scaleX, scaleY, order));
}
Status SetElements(REAL m11, REAL m12, REAL m21, REAL m22,
REAL dx, REAL dy)
{
return updateStatus(DllExports::GdipSetMatrixElements(
nativeMatrix, m11, m12, m21, m22, dx, dy));
}
Status Shear(REAL shearX, REAL shearY,
MatrixOrder order = MatrixOrderPrepend)
{
return updateStatus(DllExports::GdipShearMatrix(
nativeMatrix, shearX, shearY, order));
}
Status TransformPoints(PointF *pts, INT count = 1) const
{
return updateStatus(DllExports::GdipTransformMatrixPoints(
nativeMatrix, pts, count));
}
Status TransformPoints(Point *pts, INT count = 1) const
{
return updateStatus(DllExports::GdipTransformMatrixPointsI(
nativeMatrix, pts, count));
}
Status TransformVectors(PointF *pts, INT count = 1) const
{
return updateStatus(DllExports::GdipVectorTransformMatrixPoints(
nativeMatrix, pts, count));
}
Status TransformVectors(Point *pts, INT count = 1) const
{
return updateStatus(DllExports::GdipVectorTransformMatrixPointsI(
nativeMatrix, pts, count));
}
Status Translate(REAL offsetX, REAL offsetY,
MatrixOrder order = MatrixOrderPrepend)
{
return updateStatus(DllExports::GdipTranslateMatrix(
nativeMatrix, offsetX, offsetY, order));
}
private:
Matrix(GpMatrix *matrix, Status status):
nativeMatrix(matrix), lastStatus(status) {}
Matrix(const Matrix&);
Matrix& operator=(const Matrix&);
Status updateStatus(Status newStatus) const
{
if (newStatus != Ok) lastStatus = newStatus;
return newStatus;
}
GpMatrix *nativeMatrix;
mutable Status lastStatus;
};
#undef GDIP_MATRIX_PI
#endif /* __GDIPLUS_MATRIX_H */
|