[SDK][INCLUDE] Implementing Gdiplus::GraphicsPath (#2200)

Point, PointF, Size, SizeF, Rect and RectF are also implemented. CORE-16585
This commit is contained in:
Katayama Hirofumi MZ 2019-12-31 09:23:45 +09:00 committed by GitHub
parent f84963b0d5
commit bef5aef62b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 645 additions and 156 deletions

View file

@ -980,7 +980,7 @@ class Region : public GdiplusBase
Region(const GraphicsPath *path) Region(const GraphicsPath *path)
{ {
status = DllExports::GdipCreateRegionPath(path->path, &region); status = DllExports::GdipCreateRegionPath(path->nativePath, &region);
} }
Region(HRGN hRgn) Region(HRGN hRgn)
@ -1004,14 +1004,15 @@ class Region : public GdiplusBase
Status Status
Complement(const GraphicsPath *path) Complement(const GraphicsPath *path)
{ {
return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeComplement)); GpPath *thePath = path ? path->nativePath : NULL;
return SetStatus(DllExports::GdipCombineRegionPath(region, thePath, CombineModeComplement));
} }
Status Status
Complement(const Region *region) Complement(const Region *region)
{ {
return SetStatus( GpRegion *theRegion = region ? region->region : NULL;
DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeComplement)); return SetStatus(DllExports::GdipCombineRegionRegion(this->region, theRegion, CombineModeComplement));
} }
Status Status
@ -1038,7 +1039,7 @@ class Region : public GdiplusBase
Status Status
Exclude(const GraphicsPath *path) Exclude(const GraphicsPath *path)
{ {
return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeExclude)); return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->nativePath : NULL, CombineModeExclude));
} }
Status Status
@ -1109,20 +1110,20 @@ class Region : public GdiplusBase
Status Status
GetRegionScans(const Matrix *matrix, Rect *rects, INT *count) const GetRegionScans(const Matrix *matrix, Rect *rects, INT *count) const
{ {
return SetStatus(DllExports::GdipGetRegionScansI(region, rects, count, matrix ? matrix->matrix : NULL)); return SetStatus(DllExports::GdipGetRegionScansI(region, rects, count, matrix ? matrix->nativeMatrix : NULL));
} }
Status Status
GetRegionScans(const Matrix *matrix, RectF *rects, INT *count) const GetRegionScans(const Matrix *matrix, RectF *rects, INT *count) const
{ {
return SetStatus(DllExports::GdipGetRegionScans(region, rects, count, matrix ? matrix->matrix : NULL)); return SetStatus(DllExports::GdipGetRegionScans(region, rects, count, matrix ? matrix->nativeMatrix : NULL));
} }
UINT UINT
GetRegionScansCount(const Matrix *matrix) const GetRegionScansCount(const Matrix *matrix) const
{ {
UINT count; UINT count;
SetStatus(DllExports::GdipGetRegionScansCount(region, &count, matrix ? matrix->matrix : NULL)); SetStatus(DllExports::GdipGetRegionScansCount(region, &count, matrix ? matrix->nativeMatrix : NULL));
return count; return count;
} }
@ -1135,7 +1136,8 @@ class Region : public GdiplusBase
Status Status
Intersect(const GraphicsPath *path) Intersect(const GraphicsPath *path)
{ {
return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeIntersect)); GpPath *thePath = path ? path->nativePath : NULL;
return SetStatus(DllExports::GdipCombineRegionPath(region, thePath, CombineModeIntersect));
} }
Status Status
@ -1248,7 +1250,7 @@ class Region : public GdiplusBase
Status Status
Transform(const Matrix *matrix) Transform(const Matrix *matrix)
{ {
return SetStatus(DllExports::GdipTransformRegion(region, matrix ? matrix->matrix : NULL)); return SetStatus(DllExports::GdipTransformRegion(region, matrix ? matrix->nativeMatrix : NULL));
} }
Status Status
@ -1285,13 +1287,13 @@ class Region : public GdiplusBase
Status Status
Union(const GraphicsPath *path) Union(const GraphicsPath *path)
{ {
return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeUnion)); return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->nativePath : NULL, CombineModeUnion));
} }
Status Status
Xor(const GraphicsPath *path) Xor(const GraphicsPath *path)
{ {
return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeXor)); return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->nativePath : NULL, CombineModeXor));
} }
Status Status

View file

@ -23,82 +23,92 @@ class Matrix : public GdiplusBase
{ {
friend class Pen; friend class Pen;
friend class Region; friend class Region;
friend class GraphicsPath;
public: public:
Matrix(const RectF &rect, const PointF *dstplg) Matrix(const RectF &rect, const PointF *dstplg)
{ {
status = DllExports::GdipCreateMatrix3(&rect, dstplg, &matrix); lastStatus = DllExports::GdipCreateMatrix3(&rect, dstplg, &nativeMatrix);
} }
Matrix(const Rect &rect, const Point *dstplg) Matrix(const Rect &rect, const Point *dstplg)
{ {
status = DllExports::GdipCreateMatrix3I(&rect, dstplg, &matrix); lastStatus = DllExports::GdipCreateMatrix3I(&rect, dstplg, &nativeMatrix);
} }
Matrix(VOID) Matrix()
{ {
status = DllExports::GdipCreateMatrix(&matrix); lastStatus = DllExports::GdipCreateMatrix(&nativeMatrix);
} }
Matrix(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy) Matrix(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
{ {
status = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, &matrix); lastStatus = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, &nativeMatrix);
} }
Matrix *Clone(VOID) Matrix *
Clone()
{ {
Matrix *cloneMatrix = new Matrix(); // FIXME: Matrix::matrix already initialized --> potential memory leak GpMatrix *cloneMatrix = NULL;
cloneMatrix->status = DllExports::GdipCloneMatrix(matrix, cloneMatrix ? &cloneMatrix->matrix : NULL); SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, &cloneMatrix));
return cloneMatrix;
if (lastStatus != Ok)
return NULL;
return new Matrix(cloneMatrix);
} }
~Matrix(VOID) ~Matrix()
{ {
DllExports::GdipDeleteMatrix(matrix); DllExports::GdipDeleteMatrix(nativeMatrix);
} }
BOOL BOOL
Equals(const Matrix *matrix) Equals(const Matrix *matrix)
{ {
BOOL result; BOOL result;
SetStatus(DllExports::GdipIsMatrixEqual(this->matrix, matrix ? matrix->matrix : NULL, &result)); SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, &result));
return result; return result;
} }
Status Status
GetElements(REAL *m) const GetElements(REAL *m) const
{ {
return SetStatus(DllExports::GdipGetMatrixElements(matrix, m)); return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
} }
Status GetLastStatus(VOID) Status
GetLastStatus() const
{ {
return status; return lastStatus;
} }
Status Invert(VOID) Status
Invert()
{ {
return SetStatus(DllExports::GdipInvertMatrix(matrix)); return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix));
} }
BOOL IsIdentity(VOID) BOOL
IsIdentity()
{ {
BOOL result; BOOL result;
SetStatus(DllExports::GdipIsMatrixIdentity(matrix, &result)); SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
return result; return result;
} }
BOOL IsInvertible(VOID) BOOL
IsInvertible()
{ {
BOOL result; BOOL result;
SetStatus(DllExports::GdipIsMatrixInvertible(matrix, &result)); SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
return result; return result;
} }
Status Status
Multiply(const Matrix *matrix, MatrixOrder order) Multiply(const Matrix *matrix, MatrixOrder order)
{ {
return SetStatus(DllExports::GdipMultiplyMatrix(this->matrix, matrix ? matrix->matrix : NULL, order)); return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, order));
} }
REAL OffsetX(VOID) REAL OffsetX(VOID)
@ -119,7 +129,7 @@ class Matrix : public GdiplusBase
Status Status
Rotate(REAL angle, MatrixOrder order) Rotate(REAL angle, MatrixOrder order)
{ {
return SetStatus(DllExports::GdipRotateMatrix(matrix, angle, order)); return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order));
} }
Status Status
@ -131,61 +141,64 @@ class Matrix : public GdiplusBase
Status Status
Scale(REAL scaleX, REAL scaleY, MatrixOrder order) Scale(REAL scaleX, REAL scaleY, MatrixOrder order)
{ {
return SetStatus(DllExports::GdipScaleMatrix(matrix, scaleX, scaleY, order)); return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order));
} }
Status Status
SetElements(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy) SetElements(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
{ {
return SetStatus(DllExports::GdipSetMatrixElements(matrix, m11, m12, m21, m22, dx, dy)); return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, m11, m12, m21, m22, dx, dy));
} }
Status Status
Shear(REAL shearX, REAL shearY, MatrixOrder order) Shear(REAL shearX, REAL shearY, MatrixOrder order)
{ {
return SetStatus(DllExports::GdipShearMatrix(matrix, shearX, shearY, order)); return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order));
} }
Status Status
TransformPoints(Point *pts, INT count) TransformPoints(Point *pts, INT count)
{ {
return SetStatus(DllExports::GdipTransformMatrixPointsI(matrix, pts, count)); return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix, pts, count));
} }
Status Status
TransformPoints(PointF *pts, INT count) TransformPoints(PointF *pts, INT count)
{ {
return SetStatus(DllExports::GdipTransformMatrixPoints(matrix, pts, count)); return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix, pts, count));
} }
Status Status
TransformVectors(Point *pts, INT count) TransformVectors(Point *pts, INT count)
{ {
return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(matrix, pts, count)); return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(nativeMatrix, pts, count));
} }
Status Status
TransformVectors(PointF *pts, INT count) TransformVectors(PointF *pts, INT count)
{ {
return SetStatus(DllExports::GdipVectorTransformMatrixPoints(matrix, pts, count)); return SetStatus(DllExports::GdipVectorTransformMatrixPoints(nativeMatrix, pts, count));
} }
Status Status
Translate(REAL offsetX, REAL offsetY, MatrixOrder order) Translate(REAL offsetX, REAL offsetY, MatrixOrder order)
{ {
return SetStatus(DllExports::GdipTranslateMatrix(matrix, offsetX, offsetY, order)); return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order));
} }
private: protected:
mutable Status status; GpMatrix *nativeMatrix;
GpMatrix *matrix; mutable Status lastStatus;
Matrix(GpMatrix *matrix) : nativeMatrix(matrix), lastStatus(Ok)
{
}
Status Status
SetStatus(Status status) const SetStatus(Status status) const
{ {
if (status == Ok) if (status != Ok)
return status; lastStatus = status;
this->status = status;
return status; return status;
} }
}; };

View file

@ -27,262 +27,275 @@ class GraphicsPath : public GdiplusBase
friend class Region; friend class Region;
public: public:
GraphicsPath(const Point *points, const BYTE *types, INT count, FillMode fillMode) GraphicsPath(const Point *points, const BYTE *types, INT count, FillMode fillMode) : nativePath(NULL)
{ {
lastStatus = DllExports::GdipCreatePath2I(points, types, count, fillMode, &nativePath);
} }
GraphicsPath(FillMode fillMode) GraphicsPath(FillMode fillMode = FillModeAlternate) : nativePath(NULL)
{ {
lastStatus = DllExports::GdipCreatePath(fillMode, &nativePath);
} }
GraphicsPath(const PointF *points, const BYTE *types, INT count, FillMode fillMode) GraphicsPath(const PointF *points, const BYTE *types, INT count, FillMode fillMode = FillModeAlternate)
: nativePath(NULL)
{ {
lastStatus = DllExports::GdipCreatePath2(points, types, count, fillMode, &nativePath);
}
~GraphicsPath()
{
DllExports::GdipDeletePath(nativePath);
} }
Status Status
AddArc(const Rect &rect, REAL startAngle, REAL sweepAngle) AddArc(const Rect &rect, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
} }
Status Status
AddArc(const RectF &rect, REAL startAngle, REAL sweepAngle) AddArc(const RectF &rect, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
} }
Status Status
AddArc(INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle) AddArc(INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathArcI(nativePath, x, y, width, height, startAngle, sweepAngle));
} }
Status Status
AddArc(REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle) AddArc(REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathArc(nativePath, x, y, width, height, startAngle, sweepAngle));
} }
Status Status
AddBezier(const Point &pt1, const Point &pt2, const Point &pt3, const Point &pt4) AddBezier(const Point &pt1, const Point &pt2, const Point &pt3, const Point &pt4)
{ {
return NotImplemented; return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
} }
Status Status
AddBezier(REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4) AddBezier(REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathBezier(nativePath, x1, y1, x2, y2, x3, y3, x4, y4));
} }
Status Status
AddBezier(const PointF &pt1, const PointF &pt2, const PointF &pt3, const PointF &pt4) AddBezier(const PointF &pt1, const PointF &pt2, const PointF &pt3, const PointF &pt4)
{ {
return NotImplemented; return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
} }
Status Status
AddBezier(INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4) AddBezier(INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathBezierI(nativePath, x1, y1, x2, y2, x3, y3, x4, y4));
} }
Status Status
AddBeziers(const Point *points, INT count) AddBeziers(const Point *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathBeziersI(nativePath, points, count));
} }
Status Status
AddBeziers(const PointF *points, INT count) AddBeziers(const PointF *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathBeziers(nativePath, points, count));
} }
Status Status
AddClosedCurve(const Point *points, INT count) AddClosedCurve(const Point *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathClosedCurveI(nativePath, points, count));
} }
Status Status
AddClosedCurve(const Point *points, INT count, REAL tension) AddClosedCurve(const Point *points, INT count, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathClosedCurve2I(nativePath, points, count, tension));
} }
Status Status
AddClosedCurve(const PointF *points, INT count, REAL tension) AddClosedCurve(const PointF *points, INT count, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathClosedCurve2(nativePath, points, count, tension));
} }
Status Status
AddClosedCurve(const PointF *points, INT count) AddClosedCurve(const PointF *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathClosedCurve(nativePath, points, count));
} }
Status Status
AddCurve(const Point *points, INT count) AddCurve(const Point *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurveI(nativePath, points, count));
} }
Status Status
AddCurve(const PointF *points, INT count, REAL tension) AddCurve(const PointF *points, INT count, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurve2(nativePath, points, count, tension));
} }
Status Status
AddCurve(const PointF *points, INT count) AddCurve(const PointF *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurve(nativePath, points, count));
} }
Status Status
AddCurve(const Point *points, INT count, INT offset, INT numberOfSegments, REAL tension) AddCurve(const Point *points, INT count, INT offset, INT numberOfSegments, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurve3I(nativePath, points, count, offset, numberOfSegments, tension));
} }
Status Status
AddCurve(const Point *points, INT count, REAL tension) AddCurve(const Point *points, INT count, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurve2I(nativePath, points, count, tension));
} }
Status Status
AddCurve(const PointF *points, INT count, INT offset, INT numberOfSegments, REAL tension) AddCurve(const PointF *points, INT count, INT offset, INT numberOfSegments, REAL tension)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathCurve3(nativePath, points, count, offset, numberOfSegments, tension));
} }
Status Status
AddEllipse(const Rect &rect) AddEllipse(const Rect &rect)
{ {
return NotImplemented; return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
} }
Status Status
AddEllipse(const RectF &rect) AddEllipse(const RectF &rect)
{ {
return NotImplemented; return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
} }
Status Status
AddEllipse(INT x, INT y, INT width, INT height) AddEllipse(INT x, INT y, INT width, INT height)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathEllipseI(nativePath, x, y, width, height));
} }
Status Status
AddEllipse(REAL x, REAL y, REAL width, REAL height) AddEllipse(REAL x, REAL y, REAL width, REAL height)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathEllipse(nativePath, x, y, width, height));
} }
Status Status
AddLine(const Point &pt1, const Point &pt2) AddLine(const Point &pt1, const Point &pt2)
{ {
return NotImplemented; return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
} }
Status Status
AddLine(const PointF &pt1, const PointF &pt2) AddLine(const PointF &pt1, const PointF &pt2)
{ {
return NotImplemented; return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
} }
Status Status
AddLine(REAL x1, REAL y1, REAL x2, REAL y2) AddLine(REAL x1, REAL y1, REAL x2, REAL y2)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathLine(nativePath, x1, y1, x2, y2));
} }
Status Status
AddLine(INT x1, INT y1, INT x2, INT y2) AddLine(INT x1, INT y1, INT x2, INT y2)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathLineI(nativePath, x1, y1, x2, y2));
} }
Status Status
AddLines(const Point *points, INT count) AddLines(const Point *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathLine2I(nativePath, points, count));
} }
Status Status
AddLines(const PointF *points, INT count) AddLines(const PointF *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathLine2(nativePath, points, count));
} }
Status Status
AddPath(const GraphicsPath *addingPath, BOOL connect) AddPath(const GraphicsPath *addingPath, BOOL connect)
{ {
return NotImplemented; GpPath *nativePath2 = NULL;
if (addingPath)
nativePath2 = addingPath->nativePath;
return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect));
} }
Status Status
AddPie(const Rect &rect, REAL startAngle, REAL sweepAngle) AddPie(const Rect &rect, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
} }
Status Status
AddPie(INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle) AddPie(INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathPieI(nativePath, x, y, width, height, startAngle, sweepAngle));
} }
Status Status
AddPie(REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle) AddPie(REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathPie(nativePath, x, y, width, height, startAngle, sweepAngle));
} }
Status Status
AddPie(const RectF &rect, REAL startAngle, REAL sweepAngle) AddPie(const RectF &rect, REAL startAngle, REAL sweepAngle)
{ {
return NotImplemented; return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
} }
Status Status
AddPolygon(const Point *points, INT count) AddPolygon(const Point *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathPolygonI(nativePath, points, count));
} }
Status Status
AddPolygon(const PointF *points, INT count) AddPolygon(const PointF *points, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathPolygon(nativePath, points, count));
} }
Status Status
AddRectangle(const Rect &rect) AddRectangle(const Rect &rect)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathRectangleI(nativePath, rect.X, rect.Y, rect.Width, rect.Height));
} }
Status Status
AddRectangle(const RectF &rect) AddRectangle(const RectF &rect)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathRectangle(nativePath, rect.X, rect.Y, rect.Width, rect.Height));
} }
Status Status
AddRectangles(const Rect *rects, INT count) AddRectangles(const Rect *rects, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathRectanglesI(nativePath, rects, count));
} }
Status Status
AddRectangles(const RectF *rects, INT count) AddRectangles(const RectF *rects, INT count)
{ {
return NotImplemented; return SetStatus(DllExports::GdipAddPathRectangles(nativePath, rects, count));
} }
Status Status
@ -295,7 +308,7 @@ class GraphicsPath : public GdiplusBase
const Rect &layoutRect, const Rect &layoutRect,
const StringFormat *format) const StringFormat *format)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -308,7 +321,7 @@ class GraphicsPath : public GdiplusBase
const PointF &origin, const PointF &origin,
const StringFormat *format) const StringFormat *format)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -321,7 +334,7 @@ class GraphicsPath : public GdiplusBase
const Point &origin, const Point &origin,
const StringFormat *format) const StringFormat *format)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -334,61 +347,77 @@ class GraphicsPath : public GdiplusBase
const RectF &layoutRect, const RectF &layoutRect,
const StringFormat *format) const StringFormat *format)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status ClearMarkers(VOID) Status
ClearMarkers()
{ {
return NotImplemented; return SetStatus(DllExports::GdipClearPathMarkers(nativePath));
} }
GraphicsPath *Clone(VOID) GraphicsPath *
Clone()
{ {
return NULL; GpPath *clonepath = NULL;
SetStatus(DllExports::GdipClonePath(nativePath, &clonepath));
if (lastStatus != Ok)
return NULL;
return new GraphicsPath(clonepath);
} }
Status CloseAllFigures(VOID) Status
CloseAllFigures()
{ {
return NotImplemented; return SetStatus(DllExports::GdipClosePathFigures(nativePath));
} }
Status CloseFigure(VOID) Status
CloseFigure()
{ {
return NotImplemented; return SetStatus(DllExports::GdipClosePathFigure(nativePath));
} }
Status Status
Flatten(const Matrix *matrix, REAL flatness) Flatten(const Matrix *matrix, REAL flatness)
{ {
return NotImplemented; GpMatrix *nativeMatrix = NULL;
if (matrix)
nativeMatrix = matrix->nativeMatrix;
return SetStatus(DllExports::GdipFlattenPath(nativePath, nativeMatrix, flatness));
} }
Status Status
GetBounds(Rect *bounds, const Matrix *matrix, const Pen *pen) GetBounds(Rect *bounds, const Matrix *matrix, const Pen *pen)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
GetBounds(RectF *bounds, const Matrix *matrix, const Pen *pen) GetBounds(RectF *bounds, const Matrix *matrix, const Pen *pen)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
FillMode GetFillMode(VOID) FillMode
GetFillMode()
{ {
return FillModeAlternate; FillMode fillmode = FillModeAlternate;
SetStatus(DllExports::GdipGetPathFillMode(nativePath, &fillmode));
return fillmode;
} }
Status Status
GetLastPoint(PointF *lastPoint) GetLastPoint(PointF *lastPoint) const
{ {
return NotImplemented; return SetStatus(DllExports::GdipGetPathLastPoint(nativePath, lastPoint));
} }
Status GetLastStatus(VOID) Status
GetLastStatus() const
{ {
return NotImplemented; return lastStatus;
} }
Status Status
@ -415,7 +444,8 @@ class GraphicsPath : public GdiplusBase
return NotImplemented; return NotImplemented;
} }
INT GetPointCount(VOID) INT
GetPointCount()
{ {
return 0; return 0;
} }
@ -453,7 +483,7 @@ class GraphicsPath : public GdiplusBase
BOOL BOOL
IsVisible(const PointF &point, const Graphics *g) IsVisible(const PointF &point, const Graphics *g)
{ {
return FALSE; return IsVisible(point.X, point.Y, g);
} }
BOOL BOOL
@ -465,7 +495,7 @@ class GraphicsPath : public GdiplusBase
BOOL BOOL
IsVisible(const Point &point, const Graphics *g) IsVisible(const Point &point, const Graphics *g)
{ {
return NotImplemented; return IsVisible(point.X, point.Y, g);
} }
Status Status
@ -474,36 +504,42 @@ class GraphicsPath : public GdiplusBase
return NotImplemented; return NotImplemented;
} }
Status Reset(VOID) Status
Reset()
{ {
return NotImplemented; return SetStatus(DllExports::GdipResetPath(nativePath));
} }
Status Reverse(VOID) Status
Reverse()
{ {
return NotImplemented; return SetStatus(DllExports::GdipReversePath(nativePath));
} }
Status Status
SetFillMode(FillMode fillmode) SetFillMode(FillMode fillmode)
{ {
return NotImplemented; return SetStatus(DllExports::GdipSetPathFillMode(nativePath, fillmode));
} }
Status SetMarker(VOID) Status
SetMarker()
{ {
return NotImplemented; return SetStatus(DllExports::GdipSetPathMarker(nativePath));
} }
Status StartFigure(VOID) Status
StartFigure()
{ {
return NotImplemented; return SetStatus(DllExports::GdipStartPathFigure(nativePath));
} }
Status Status
Transform(const Matrix *matrix) Transform(const Matrix *matrix)
{ {
return NotImplemented; if (!matrix)
return Ok;
return SetStatus(DllExports::GdipTransformPath(nativePath, matrix->nativeMatrix));
} }
Status Status
@ -515,17 +551,52 @@ class GraphicsPath : public GdiplusBase
WarpMode warpMode, WarpMode warpMode,
REAL flatness) REAL flatness)
{ {
return NotImplemented; GpMatrix *nativeMatrix = NULL;
if (matrix)
nativeMatrix = matrix->nativeMatrix;
return SetStatus(DllExports::GdipWarpPath(
nativePath, nativeMatrix, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode,
flatness));
} }
Status Status
Widen(const Pen *pen, const Matrix *matrix, REAL flatness) Widen(const Pen *pen, const Matrix *matrix, REAL flatness)
{ {
return NotImplemented; return SetStatus(NotImplemented);
}
protected:
GpPath *nativePath;
mutable Status lastStatus;
GraphicsPath()
{
}
GraphicsPath(GpPath *path) : nativePath(path), lastStatus(Ok)
{
}
Status
SetStatus(Status status) const
{
if (status != Ok)
lastStatus = status;
return status;
}
void
SetNativePath(GpPath *path)
{
nativePath = path;
} }
private: private:
GpPath *path; // GraphicsPath is not copyable
GraphicsPath(const GraphicsPath &);
GraphicsPath &
operator=(const GraphicsPath &);
}; };
class GraphicsPathIterator : public GdiplusBase class GraphicsPathIterator : public GdiplusBase
@ -547,22 +618,26 @@ class GraphicsPathIterator : public GdiplusBase
return 0; return 0;
} }
INT GetCount(VOID) INT
GetCount()
{ {
return 0; return 0;
} }
Status GetLastStatus(VOID) Status
GetLastStatus() const
{ {
return NotImplemented; return NotImplemented;
} }
INT GetSubpathCount(VOID) INT
GetSubpathCount() const
{ {
return 0; return 0;
} }
BOOL HasCurve(VOID) BOOL
HasCurve() const
{ {
return FALSE; return FALSE;
} }
@ -597,7 +672,8 @@ class GraphicsPathIterator : public GdiplusBase
return 0; return 0;
} }
VOID Rewind(VOID) VOID
Rewind()
{ {
} }
}; };
@ -617,7 +693,8 @@ class PathGradientBrush : public Brush
{ {
} }
INT GetBlendCount(VOID) INT
GetBlendCount()
{ {
return 0; return 0;
} }
@ -652,7 +729,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
BOOL GetGammaCorrection(VOID) BOOL
GetGammaCorrection()
{ {
return FALSE; return FALSE;
} }
@ -663,7 +741,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
INT GetInterpolationColorCount(VOID) INT
GetInterpolationColorCount()
{ {
return 0; return 0;
} }
@ -674,7 +753,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
INT GetPointCount(VOID) INT
GetPointCount()
{ {
return 0; return 0;
} }
@ -691,7 +771,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
INT GetSurroundColorCount(VOID) INT
GetSurroundColorCount()
{ {
return 0; return 0;
} }
@ -708,7 +789,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
WrapMode GetWrapMode(VOID) WrapMode
GetWrapMode()
{ {
return WrapModeTile; return WrapModeTile;
} }
@ -719,7 +801,8 @@ class PathGradientBrush : public Brush
return NotImplemented; return NotImplemented;
} }
Status ResetTransform(VOID) Status
ResetTransform()
{ {
return NotImplemented; return NotImplemented;
} }

View file

@ -180,7 +180,7 @@ class Pen : public GdiplusBase
MultiplyTransform(Matrix *matrix, MatrixOrder order) MultiplyTransform(Matrix *matrix, MatrixOrder order)
{ {
return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipMultiplyPenTransform(pen, matrix ? return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipMultiplyPenTransform(pen, matrix ?
// matrix->matrix : NULL, order)); // matrix->nativeMatrix : NULL, order));
} }
Status ResetTransform(VOID) Status ResetTransform(VOID)
@ -294,7 +294,7 @@ class Pen : public GdiplusBase
Status Status
SetTransform(const Matrix *matrix) SetTransform(const Matrix *matrix)
{ {
return SetStatus(DllExports::GdipSetPenTransform(pen, matrix ? matrix->matrix : NULL)); return SetStatus(DllExports::GdipSetPenTransform(pen, matrix ? matrix->nativeMatrix : NULL));
} }
Status Status

View file

@ -65,6 +65,8 @@ extern "C"
#ifdef __cplusplus #ifdef __cplusplus
class Size;
class Point class Point
{ {
public: public:
@ -79,7 +81,7 @@ class Point
Y = pt.Y; Y = pt.Y;
} }
/* FIXME: missing constructor that takes a Size */ Point(const Size &size);
Point(IN INT x, IN INT y) Point(IN INT x, IN INT y)
{ {
@ -100,7 +102,7 @@ class Point
} }
BOOL BOOL
Equals(IN const Point &pt) Equals(IN const Point &pt) const
{ {
return (X == pt.X) && (Y == pt.Y); return (X == pt.X) && (Y == pt.Y);
} }
@ -110,6 +112,8 @@ class Point
INT Y; INT Y;
}; };
class SizeF;
class PointF class PointF
{ {
public: public:
@ -124,7 +128,7 @@ class PointF
Y = pt.Y; Y = pt.Y;
} }
/* FIXME: missing constructor that takes a SizeF */ PointF(const SizeF &size);
PointF(IN REAL x, IN REAL y) PointF(IN REAL x, IN REAL y)
{ {
@ -145,7 +149,7 @@ class PointF
} }
BOOL BOOL
Equals(IN const PointF &pt) Equals(IN const PointF &pt) const
{ {
return (X == pt.X) && (Y == pt.Y); return (X == pt.X) && (Y == pt.Y);
} }
@ -189,7 +193,51 @@ class PathData
BYTE *Types; BYTE *Types;
}; };
/* FIXME: missing the methods. */ class SizeF
{
public:
REAL Width;
REAL Height;
SizeF() : Width(0), Height(0)
{
}
SizeF(const SizeF &size) : Width(size.Width), Height(size.Height)
{
}
SizeF(REAL width, REAL height) : Width(width), Height(height)
{
}
BOOL
Empty() const
{
return Width == 0 && Height == 0;
}
BOOL
Equals(const SizeF &sz) const
{
return Width == sz.Width && Height == sz.Height;
}
SizeF
operator+(const SizeF &sz) const
{
return SizeF(Width + sz.Width, Height + sz.Height);
}
SizeF
operator-(const SizeF &sz) const
{
return SizeF(Width - sz.Width, Height - sz.Height);
}
};
#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */
class RectF class RectF
{ {
public: public:
@ -197,9 +245,202 @@ class RectF
REAL Y; REAL Y;
REAL Width; REAL Width;
REAL Height; REAL Height;
RectF() : X(0), Y(0), Width(0), Height(0)
{
}
RectF(const PointF &location, const SizeF &size)
: X(location.X), Y(location.Y), Width(size.Width), Height(size.Height)
{
}
RectF(REAL x, REAL y, REAL width, REAL height) : X(x), Y(y), Width(width), Height(height)
{
}
RectF *
Clone() const
{
return new RectF(X, Y, Width, Height);
}
BOOL
Contains(const PointF &pt) const
{
return Contains(pt.X, pt.Y);
}
BOOL
Contains(const RectF &rect) const
{
return X <= rect.X && rect.GetRight() <= GetRight() && Y <= rect.Y && rect.GetBottom() <= GetBottom();
}
BOOL
Contains(REAL x, REAL y) const
{
return X <= x && x < X + Width && Y <= y && y < Y + Height;
}
BOOL
Equals(const RectF &rect) const
{
return X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height;
}
REAL
GetBottom() const
{
return Y + Height;
}
VOID
GetBounds(RectF *rect) const
{
rect->X = X;
rect->Y = Y;
rect->Width = Width;
rect->Height = Height;
}
REAL
GetLeft() const
{
return X;
}
VOID
GetLocation(PointF *point) const
{
point->X = X;
point->Y = Y;
}
REAL
GetRight() const
{
return X + Width;
}
VOID
GetSize(SizeF *size) const
{
size->Width = Width;
size->Height = Height;
}
REAL
GetTop() const
{
return Y;
}
VOID
Inflate(REAL dx, REAL dy)
{
X -= dx;
Y -= dy;
Width += 2 * dx;
Height += 2 * dy;
}
VOID
Inflate(const PointF &point)
{
Inflate(point.X, point.Y);
}
static BOOL
Intersect(RectF &c, const RectF &a, const RectF &b)
{
// FIXME
return FALSE;
}
BOOL
Intersect(const RectF &rect)
{
return Intersect(*this, *this, rect);
}
BOOL
IntersectsWith(const RectF &rect) const
{
return GetLeft() < rect.GetRight() && GetTop() < rect.GetTop() && GetRight() > rect.GetLeft() &&
GetBottom() > rect.GetTop();
}
BOOL
IsEmptyArea() const
{
return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON);
}
VOID
Offset(REAL dx, REAL dy)
{
X += dx;
Y += dy;
}
VOID
Offset(const PointF &point)
{
Offset(point.X, point.Y);
}
static BOOL
Union(RectF &c, const RectF &a, const RectF &b)
{
// FIXME
return FALSE;
}
};
class Size
{
public:
INT Width;
INT Height;
Size() : Width(0), Height(0)
{
}
Size(const Size &size) : Width(size.Width), Height(size.Height)
{
}
Size(INT width, INT height) : Width(width), Height(height)
{
}
BOOL
Empty() const
{
return Width == 0 && Height == 0;
}
BOOL
Equals(const Size &sz) const
{
return Width == sz.Width && Height == sz.Height;
}
Size
operator+(const Size &sz) const
{
return Size(Width + sz.Width, Height + sz.Height);
}
Size
operator-(const Size &sz) const
{
return Size(Width - sz.Width, Height - sz.Height);
}
}; };
/* FIXME: missing the methods. */
class Rect class Rect
{ {
public: public:
@ -207,6 +448,156 @@ class Rect
INT Y; INT Y;
INT Width; INT Width;
INT Height; INT Height;
Rect() : X(0), Y(0), Width(0), Height(0)
{
}
Rect(const Point &location, const Size &size) : X(location.X), Y(location.Y), Width(size.Width), Height(size.Height)
{
}
Rect(INT x, INT y, INT width, INT height) : X(x), Y(y), Width(width), Height(height)
{
}
Rect *
Clone() const
{
return new Rect(X, Y, Width, Height);
}
BOOL
Contains(const Point &pt) const
{
return Contains(pt.X, pt.Y);
}
BOOL
Contains(const Rect &rect) const
{
return X <= rect.X && rect.GetRight() <= GetRight() && Y <= rect.Y && rect.GetBottom() <= GetBottom();
}
BOOL
Contains(INT x, INT y) const
{
return X <= x && x < X + Width && Y <= y && y < Y + Height;
}
BOOL
Equals(const Rect &rect) const
{
return X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height;
}
INT
GetBottom() const
{
return Y + Height;
}
VOID
GetBounds(Rect *rect) const
{
rect->X = X;
rect->Y = Y;
rect->Width = Width;
rect->Height = Height;
}
INT
GetLeft() const
{
return X;
}
VOID
GetLocation(Point *point) const
{
point->X = X;
point->Y = Y;
}
INT
GetRight() const
{
return X + Width;
}
VOID
GetSize(Size *size) const
{
size->Width = Width;
size->Height = Height;
}
INT
GetTop() const
{
return Y;
}
VOID
Inflate(INT dx, INT dy)
{
X -= dx;
Y -= dy;
Width += 2 * dx;
Height += 2 * dy;
}
VOID
Inflate(const Point &point)
{
Inflate(point.X, point.Y);
}
static BOOL
Intersect(Rect &c, const Rect &a, const Rect &b)
{
// FIXME
return FALSE;
}
BOOL
Intersect(const Rect &rect)
{
return Intersect(*this, *this, rect);
}
BOOL
IntersectsWith(const Rect &rect) const
{
return GetLeft() < rect.GetRight() && GetTop() < rect.GetTop() && GetRight() > rect.GetLeft() &&
GetBottom() > rect.GetTop();
}
BOOL
IsEmptyArea() const
{
return Width <= 0 || Height <= 0;
}
VOID
Offset(INT dx, INT dy)
{
X += dx;
Y += dy;
}
VOID
Offset(const Point &point)
{
Offset(point.X, point.Y);
}
static BOOL
Union(Rect &c, const Rect &a, const Rect &b)
{
// FIXME
return FALSE;
}
}; };
class CharacterRange class CharacterRange
@ -236,13 +627,13 @@ class CharacterRange
INT Length; INT Length;
}; };
/* FIXME: missing the methods. */ inline Point::Point(const Size &size) : X(size.Width), Y(size.Height)
class SizeF
{ {
public: }
REAL Width;
REAL Height; inline PointF::PointF(const SizeF &size) : X(size.Width), Y(size.Height)
}; {
}
#else /* end of c++ typedefs */ #else /* end of c++ typedefs */