https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bef5aef62b5f885874978…
commit bef5aef62b5f885874978a09b450ad31028edb9e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Dec 31 09:23:45 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Dec 31 09:23:45 2019 +0900
[SDK][INCLUDE] Implementing Gdiplus::GraphicsPath (#2200)
Point, PointF, Size, SizeF, Rect and RectF are also implemented. CORE-16585
---
sdk/include/psdk/gdiplusheaders.h | 26 +--
sdk/include/psdk/gdiplusmatrix.h | 87 ++++----
sdk/include/psdk/gdipluspath.h | 269 +++++++++++++++---------
sdk/include/psdk/gdipluspen.h | 4 +-
sdk/include/psdk/gdiplustypes.h | 415 ++++++++++++++++++++++++++++++++++++--
5 files changed, 645 insertions(+), 156 deletions(-)
diff --git a/sdk/include/psdk/gdiplusheaders.h b/sdk/include/psdk/gdiplusheaders.h
index 3383018d7a6..8ee22310432 100644
--- a/sdk/include/psdk/gdiplusheaders.h
+++ b/sdk/include/psdk/gdiplusheaders.h
@@ -980,7 +980,7 @@ class Region : public GdiplusBase
Region(const GraphicsPath *path)
{
- status = DllExports::GdipCreateRegionPath(path->path, ®ion);
+ status = DllExports::GdipCreateRegionPath(path->nativePath, ®ion);
}
Region(HRGN hRgn)
@@ -1004,14 +1004,15 @@ class Region : public GdiplusBase
Status
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
Complement(const Region *region)
{
- return SetStatus(
- DllExports::GdipCombineRegionRegion(this->region, region ?
region->region : NULL, CombineModeComplement));
+ GpRegion *theRegion = region ? region->region : NULL;
+ return SetStatus(DllExports::GdipCombineRegionRegion(this->region, theRegion,
CombineModeComplement));
}
Status
@@ -1038,7 +1039,7 @@ class Region : public GdiplusBase
Status
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
@@ -1109,20 +1110,20 @@ class Region : public GdiplusBase
Status
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
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
GetRegionScansCount(const Matrix *matrix) const
{
UINT count;
- SetStatus(DllExports::GdipGetRegionScansCount(region, &count, matrix ?
matrix->matrix : NULL));
+ SetStatus(DllExports::GdipGetRegionScansCount(region, &count, matrix ?
matrix->nativeMatrix : NULL));
return count;
}
@@ -1135,7 +1136,8 @@ class Region : public GdiplusBase
Status
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
@@ -1248,7 +1250,7 @@ class Region : public GdiplusBase
Status
Transform(const Matrix *matrix)
{
- return SetStatus(DllExports::GdipTransformRegion(region, matrix ?
matrix->matrix : NULL));
+ return SetStatus(DllExports::GdipTransformRegion(region, matrix ?
matrix->nativeMatrix : NULL));
}
Status
@@ -1285,13 +1287,13 @@ class Region : public GdiplusBase
Status
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
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
diff --git a/sdk/include/psdk/gdiplusmatrix.h b/sdk/include/psdk/gdiplusmatrix.h
index 3208e1edcfd..c2425c3ff1c 100644
--- a/sdk/include/psdk/gdiplusmatrix.h
+++ b/sdk/include/psdk/gdiplusmatrix.h
@@ -23,82 +23,92 @@ class Matrix : public GdiplusBase
{
friend class Pen;
friend class Region;
+ friend class GraphicsPath;
public:
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)
{
- 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)
{
- 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
- cloneMatrix->status = DllExports::GdipCloneMatrix(matrix, cloneMatrix ?
&cloneMatrix->matrix : NULL);
- return cloneMatrix;
+ GpMatrix *cloneMatrix = NULL;
+ SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, &cloneMatrix));
+
+ if (lastStatus != Ok)
+ return NULL;
+
+ return new Matrix(cloneMatrix);
}
- ~Matrix(VOID)
+ ~Matrix()
{
- DllExports::GdipDeleteMatrix(matrix);
+ DllExports::GdipDeleteMatrix(nativeMatrix);
}
BOOL
Equals(const Matrix *matrix)
{
BOOL result;
- SetStatus(DllExports::GdipIsMatrixEqual(this->matrix, matrix ?
matrix->matrix : NULL, &result));
+ SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ?
matrix->nativeMatrix : NULL, &result));
return result;
}
Status
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;
- SetStatus(DllExports::GdipIsMatrixIdentity(matrix, &result));
+ SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
return result;
}
- BOOL IsInvertible(VOID)
+ BOOL
+ IsInvertible()
{
BOOL result;
- SetStatus(DllExports::GdipIsMatrixInvertible(matrix, &result));
+ SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
return result;
}
Status
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)
@@ -119,7 +129,7 @@ class Matrix : public GdiplusBase
Status
Rotate(REAL angle, MatrixOrder order)
{
- return SetStatus(DllExports::GdipRotateMatrix(matrix, angle, order));
+ return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order));
}
Status
@@ -131,61 +141,64 @@ class Matrix : public GdiplusBase
Status
Scale(REAL scaleX, REAL scaleY, MatrixOrder order)
{
- return SetStatus(DllExports::GdipScaleMatrix(matrix, scaleX, scaleY, order));
+ return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY,
order));
}
Status
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
Shear(REAL shearX, REAL shearY, MatrixOrder order)
{
- return SetStatus(DllExports::GdipShearMatrix(matrix, shearX, shearY, order));
+ return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY,
order));
}
Status
TransformPoints(Point *pts, INT count)
{
- return SetStatus(DllExports::GdipTransformMatrixPointsI(matrix, pts, count));
+ return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix, pts,
count));
}
Status
TransformPoints(PointF *pts, INT count)
{
- return SetStatus(DllExports::GdipTransformMatrixPoints(matrix, pts, count));
+ return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix, pts,
count));
}
Status
TransformVectors(Point *pts, INT count)
{
- return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(matrix, pts,
count));
+ return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(nativeMatrix, pts,
count));
}
Status
TransformVectors(PointF *pts, INT count)
{
- return SetStatus(DllExports::GdipVectorTransformMatrixPoints(matrix, pts,
count));
+ return SetStatus(DllExports::GdipVectorTransformMatrixPoints(nativeMatrix, pts,
count));
}
Status
Translate(REAL offsetX, REAL offsetY, MatrixOrder order)
{
- return SetStatus(DllExports::GdipTranslateMatrix(matrix, offsetX, offsetY,
order));
+ return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY,
order));
}
- private:
- mutable Status status;
- GpMatrix *matrix;
+ protected:
+ GpMatrix *nativeMatrix;
+ mutable Status lastStatus;
+
+ Matrix(GpMatrix *matrix) : nativeMatrix(matrix), lastStatus(Ok)
+ {
+ }
Status
SetStatus(Status status) const
{
- if (status == Ok)
- return status;
- this->status = status;
+ if (status != Ok)
+ lastStatus = status;
return status;
}
};
diff --git a/sdk/include/psdk/gdipluspath.h b/sdk/include/psdk/gdipluspath.h
index 8d9b58db422..5d57df2bf1e 100644
--- a/sdk/include/psdk/gdipluspath.h
+++ b/sdk/include/psdk/gdipluspath.h
@@ -27,262 +27,275 @@ class GraphicsPath : public GdiplusBase
friend class Region;
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
AddArc(const Rect &rect, REAL startAngle, REAL sweepAngle)
{
- return NotImplemented;
+ return AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
Status
AddArc(const RectF &rect, REAL startAngle, REAL sweepAngle)
{
- return NotImplemented;
+ return AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
Status
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
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
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
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
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
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
AddBeziers(const Point *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathBeziersI(nativePath, points, count));
}
Status
AddBeziers(const PointF *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathBeziers(nativePath, points, count));
}
Status
AddClosedCurve(const Point *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathClosedCurveI(nativePath, points,
count));
}
Status
AddClosedCurve(const Point *points, INT count, REAL tension)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathClosedCurve2I(nativePath, points, count,
tension));
}
Status
AddClosedCurve(const PointF *points, INT count, REAL tension)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathClosedCurve2(nativePath, points, count,
tension));
}
Status
AddClosedCurve(const PointF *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathClosedCurve(nativePath, points, count));
}
Status
AddCurve(const Point *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathCurveI(nativePath, points, count));
}
Status
AddCurve(const PointF *points, INT count, REAL tension)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathCurve2(nativePath, points, count,
tension));
}
Status
AddCurve(const PointF *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathCurve(nativePath, points, count));
}
Status
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
AddCurve(const Point *points, INT count, REAL tension)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathCurve2I(nativePath, points, count,
tension));
}
Status
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
AddEllipse(const Rect &rect)
{
- return NotImplemented;
+ return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}
Status
AddEllipse(const RectF &rect)
{
- return NotImplemented;
+ return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}
Status
AddEllipse(INT x, INT y, INT width, INT height)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathEllipseI(nativePath, x, y, width,
height));
}
Status
AddEllipse(REAL x, REAL y, REAL width, REAL height)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathEllipse(nativePath, x, y, width,
height));
}
Status
AddLine(const Point &pt1, const Point &pt2)
{
- return NotImplemented;
+ return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
}
Status
AddLine(const PointF &pt1, const PointF &pt2)
{
- return NotImplemented;
+ return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
}
Status
AddLine(REAL x1, REAL y1, REAL x2, REAL y2)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathLine(nativePath, x1, y1, x2, y2));
}
Status
AddLine(INT x1, INT y1, INT x2, INT y2)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathLineI(nativePath, x1, y1, x2, y2));
}
Status
AddLines(const Point *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathLine2I(nativePath, points, count));
}
Status
AddLines(const PointF *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathLine2(nativePath, points, count));
}
Status
AddPath(const GraphicsPath *addingPath, BOOL connect)
{
- return NotImplemented;
+ GpPath *nativePath2 = NULL;
+ if (addingPath)
+ nativePath2 = addingPath->nativePath;
+
+ return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect));
}
Status
AddPie(const Rect &rect, REAL startAngle, REAL sweepAngle)
{
- return NotImplemented;
+ return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
Status
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
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
AddPie(const RectF &rect, REAL startAngle, REAL sweepAngle)
{
- return NotImplemented;
+ return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
Status
AddPolygon(const Point *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathPolygonI(nativePath, points, count));
}
Status
AddPolygon(const PointF *points, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathPolygon(nativePath, points, count));
}
Status
AddRectangle(const Rect &rect)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathRectangleI(nativePath, rect.X, rect.Y,
rect.Width, rect.Height));
}
Status
AddRectangle(const RectF &rect)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathRectangle(nativePath, rect.X, rect.Y,
rect.Width, rect.Height));
}
Status
AddRectangles(const Rect *rects, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathRectanglesI(nativePath, rects, count));
}
Status
AddRectangles(const RectF *rects, INT count)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipAddPathRectangles(nativePath, rects, count));
}
Status
@@ -295,7 +308,7 @@ class GraphicsPath : public GdiplusBase
const Rect &layoutRect,
const StringFormat *format)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -308,7 +321,7 @@ class GraphicsPath : public GdiplusBase
const PointF &origin,
const StringFormat *format)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -321,7 +334,7 @@ class GraphicsPath : public GdiplusBase
const Point &origin,
const StringFormat *format)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -334,61 +347,77 @@ class GraphicsPath : public GdiplusBase
const RectF &layoutRect,
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
Flatten(const Matrix *matrix, REAL flatness)
{
- return NotImplemented;
+ GpMatrix *nativeMatrix = NULL;
+ if (matrix)
+ nativeMatrix = matrix->nativeMatrix;
+
+ return SetStatus(DllExports::GdipFlattenPath(nativePath, nativeMatrix,
flatness));
}
Status
GetBounds(Rect *bounds, const Matrix *matrix, const Pen *pen)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
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
- 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
@@ -415,7 +444,8 @@ class GraphicsPath : public GdiplusBase
return NotImplemented;
}
- INT GetPointCount(VOID)
+ INT
+ GetPointCount()
{
return 0;
}
@@ -453,7 +483,7 @@ class GraphicsPath : public GdiplusBase
BOOL
IsVisible(const PointF &point, const Graphics *g)
{
- return FALSE;
+ return IsVisible(point.X, point.Y, g);
}
BOOL
@@ -465,7 +495,7 @@ class GraphicsPath : public GdiplusBase
BOOL
IsVisible(const Point &point, const Graphics *g)
{
- return NotImplemented;
+ return IsVisible(point.X, point.Y, g);
}
Status
@@ -474,36 +504,42 @@ class GraphicsPath : public GdiplusBase
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
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
Transform(const Matrix *matrix)
{
- return NotImplemented;
+ if (!matrix)
+ return Ok;
+ return SetStatus(DllExports::GdipTransformPath(nativePath,
matrix->nativeMatrix));
}
Status
@@ -515,17 +551,52 @@ class GraphicsPath : public GdiplusBase
WarpMode warpMode,
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
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:
- GpPath *path;
+ // GraphicsPath is not copyable
+ GraphicsPath(const GraphicsPath &);
+ GraphicsPath &
+ operator=(const GraphicsPath &);
};
class GraphicsPathIterator : public GdiplusBase
@@ -547,22 +618,26 @@ class GraphicsPathIterator : public GdiplusBase
return 0;
}
- INT GetCount(VOID)
+ INT
+ GetCount()
{
return 0;
}
- Status GetLastStatus(VOID)
+ Status
+ GetLastStatus() const
{
return NotImplemented;
}
- INT GetSubpathCount(VOID)
+ INT
+ GetSubpathCount() const
{
return 0;
}
- BOOL HasCurve(VOID)
+ BOOL
+ HasCurve() const
{
return FALSE;
}
@@ -597,7 +672,8 @@ class GraphicsPathIterator : public GdiplusBase
return 0;
}
- VOID Rewind(VOID)
+ VOID
+ Rewind()
{
}
};
@@ -617,7 +693,8 @@ class PathGradientBrush : public Brush
{
}
- INT GetBlendCount(VOID)
+ INT
+ GetBlendCount()
{
return 0;
}
@@ -652,7 +729,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- BOOL GetGammaCorrection(VOID)
+ BOOL
+ GetGammaCorrection()
{
return FALSE;
}
@@ -663,7 +741,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- INT GetInterpolationColorCount(VOID)
+ INT
+ GetInterpolationColorCount()
{
return 0;
}
@@ -674,7 +753,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- INT GetPointCount(VOID)
+ INT
+ GetPointCount()
{
return 0;
}
@@ -691,7 +771,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- INT GetSurroundColorCount(VOID)
+ INT
+ GetSurroundColorCount()
{
return 0;
}
@@ -708,7 +789,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- WrapMode GetWrapMode(VOID)
+ WrapMode
+ GetWrapMode()
{
return WrapModeTile;
}
@@ -719,7 +801,8 @@ class PathGradientBrush : public Brush
return NotImplemented;
}
- Status ResetTransform(VOID)
+ Status
+ ResetTransform()
{
return NotImplemented;
}
diff --git a/sdk/include/psdk/gdipluspen.h b/sdk/include/psdk/gdipluspen.h
index 7b36f52cfdc..18f73636d88 100644
--- a/sdk/include/psdk/gdipluspen.h
+++ b/sdk/include/psdk/gdipluspen.h
@@ -180,7 +180,7 @@ class Pen : public GdiplusBase
MultiplyTransform(Matrix *matrix, MatrixOrder order)
{
return NotImplemented; // FIXME: not available:
SetStatus(DllExports::GdipMultiplyPenTransform(pen, matrix ?
- // matrix->matrix : NULL, order));
+ // matrix->nativeMatrix : NULL, order));
}
Status ResetTransform(VOID)
@@ -294,7 +294,7 @@ class Pen : public GdiplusBase
Status
SetTransform(const Matrix *matrix)
{
- return SetStatus(DllExports::GdipSetPenTransform(pen, matrix ? matrix->matrix
: NULL));
+ return SetStatus(DllExports::GdipSetPenTransform(pen, matrix ?
matrix->nativeMatrix : NULL));
}
Status
diff --git a/sdk/include/psdk/gdiplustypes.h b/sdk/include/psdk/gdiplustypes.h
index 8d39d004add..bb3d8535b12 100644
--- a/sdk/include/psdk/gdiplustypes.h
+++ b/sdk/include/psdk/gdiplustypes.h
@@ -65,6 +65,8 @@ extern "C"
#ifdef __cplusplus
+class Size;
+
class Point
{
public:
@@ -79,7 +81,7 @@ class Point
Y = pt.Y;
}
- /* FIXME: missing constructor that takes a Size */
+ Point(const Size &size);
Point(IN INT x, IN INT y)
{
@@ -100,7 +102,7 @@ class Point
}
BOOL
- Equals(IN const Point &pt)
+ Equals(IN const Point &pt) const
{
return (X == pt.X) && (Y == pt.Y);
}
@@ -110,6 +112,8 @@ class Point
INT Y;
};
+class SizeF;
+
class PointF
{
public:
@@ -124,7 +128,7 @@ class PointF
Y = pt.Y;
}
- /* FIXME: missing constructor that takes a SizeF */
+ PointF(const SizeF &size);
PointF(IN REAL x, IN REAL y)
{
@@ -145,7 +149,7 @@ class PointF
}
BOOL
- Equals(IN const PointF &pt)
+ Equals(IN const PointF &pt) const
{
return (X == pt.X) && (Y == pt.Y);
}
@@ -189,7 +193,51 @@ class PathData
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
{
public:
@@ -197,9 +245,202 @@ class RectF
REAL Y;
REAL Width;
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
{
public:
@@ -207,6 +448,156 @@ class Rect
INT Y;
INT Width;
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
@@ -236,13 +627,13 @@ class CharacterRange
INT Length;
};
-/* FIXME: missing the methods. */
-class SizeF
+inline Point::Point(const Size &size) : X(size.Width), Y(size.Height)
{
- public:
- REAL Width;
- REAL Height;
-};
+}
+
+inline PointF::PointF(const SizeF &size) : X(size.Width), Y(size.Height)
+{
+}
#else /* end of c++ typedefs */