}
Matrix *
- Clone()
+ Clone() const
{
GpMatrix *cloneMatrix = NULL;
SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, &cloneMatrix));
if (lastStatus != Ok)
return NULL;
- return new Matrix(cloneMatrix);
+ Matrix *newMatrix = new Matrix(cloneMatrix);
+ if (!newMatrix)
+ DllExports::GdipDeleteMatrix(cloneMatrix);
+
+ return newMatrix;
}
~Matrix()
}
BOOL
- Equals(const Matrix *matrix)
+ Equals(const Matrix *matrix) const
{
BOOL result;
- SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, &result));
+ SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ? getNat(matrix) : NULL, &result));
return result;
}
}
BOOL
- IsIdentity()
+ IsIdentity() const
{
BOOL result;
SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
}
BOOL
- IsInvertible()
+ IsInvertible() const
{
BOOL result;
SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
}
Status
- Multiply(const Matrix *matrix, MatrixOrder order)
+ Multiply(const Matrix *matrix, MatrixOrder order = MatrixOrderPrepend)
{
- return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, order));
+ return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, matrix ? getNat(matrix) : NULL, order));
}
- REAL OffsetX(VOID)
+ REAL
+ OffsetX() const
{
- return 0;
+ REAL elements[6];
+ if (GetElements(elements) == Ok)
+ return elements[4];
+ return 0.0f;
}
- REAL OffsetY(VOID)
+ REAL
+ OffsetY() const
{
- return 0;
+ REAL elements[6];
+ if (GetElements(elements) == Ok)
+ return elements[5];
+ return 0.0f;
}
- Status Reset(VOID)
+ Status
+ Reset()
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
}
Status
- Rotate(REAL angle, MatrixOrder order)
+ Rotate(REAL angle, MatrixOrder order = MatrixOrderPrepend)
{
return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order));
}
Status
- RotateAt(REAL angle, const PointF ¢er, MatrixOrder order)
- {
- return NotImplemented;
+ RotateAt(REAL angle, const PointF ¢er, MatrixOrder order = MatrixOrderPrepend)
+ {
+ if (order == MatrixOrderPrepend)
+ {
+ SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order));
+ SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order));
+ return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, -center.X, -center.Y, order));
+ }
+ else
+ {
+ SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, -center.X, -center.Y, order));
+ SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order));
+ return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order));
+ }
}
Status
- Scale(REAL scaleX, REAL scaleY, MatrixOrder order)
+ Scale(REAL scaleX, REAL scaleY, MatrixOrder order = MatrixOrderPrepend)
{
return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order));
}
}
Status
- Shear(REAL shearX, REAL shearY, MatrixOrder order)
+ Shear(REAL shearX, REAL shearY, MatrixOrder order = MatrixOrderPrepend)
{
return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order));
}
}
Status
- Translate(REAL offsetX, REAL offsetY, MatrixOrder order)
+ Translate(REAL offsetX, REAL offsetY, MatrixOrder order = MatrixOrderPrepend)
{
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order));
}