4 * GDI+ GraphicsPath class
\r
6 * This file is part of the w32api package.
\r
9 * Created by Markus Koenig <markus@stber-koenig.de>
\r
11 * THIS SOFTWARE IS NOT COPYRIGHTED
\r
13 * This source code is offered for use in the public domain. You may
\r
14 * use, modify or distribute it freely.
\r
16 * This code is distributed in the hope that it will be useful but
\r
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
\r
18 * DISCLAIMED. This includes but is not limited to warranties of
\r
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
23 #ifndef __GDIPLUS_PATH_H
\r
24 #define __GDIPLUS_PATH_H
\r
26 #pragma GCC system_header
\r
30 #error "A C++ compiler is required to include gdipluspath.h."
\r
33 // Note that some methods of GraphicsPath are implemented in gdiplusimpl.h.
\r
34 // This avoids a cyclic dependency on Graphics and Pen.
\r
36 class GraphicsPath: public GdiplusBase
\r
38 friend class CustomLineCap;
\r
39 friend class Graphics;
\r
40 friend class GraphicsPathIterator;
\r
41 friend class PathGradientBrush;
\r
42 friend class Region;
\r
45 GraphicsPath(FillMode fillMode = FillModeAlternate):
\r
46 nativePath(NULL), lastStatus(Ok)
\r
48 lastStatus = DllExports::GdipCreatePath(fillMode, &nativePath);
\r
50 GraphicsPath(const PointF *points, const BYTE *types, INT count,
\r
51 FillMode fillMode = FillModeAlternate):
\r
52 nativePath(NULL), lastStatus(Ok)
\r
54 lastStatus = DllExports::GdipCreatePath2(
\r
55 points, types, count, fillMode, &nativePath);
\r
57 GraphicsPath(const Point *points, const BYTE *types, INT count,
\r
58 FillMode fillMode = FillModeAlternate):
\r
59 nativePath(NULL), lastStatus(Ok)
\r
61 lastStatus = DllExports::GdipCreatePath2I(
\r
62 points, types, count, fillMode, &nativePath);
\r
66 DllExports::GdipDeletePath(nativePath);
\r
68 GraphicsPath* Clone() const
\r
70 GpPath *clonePath = NULL;
\r
71 Status status = updateStatus(DllExports::GdipClonePath(
\r
72 nativePath, &clonePath));
\r
74 GraphicsPath *result = new GraphicsPath(clonePath, lastStatus);
\r
76 DllExports::GdipDeletePath(clonePath);
\r
77 lastStatus = OutOfMemory;
\r
85 Status AddArc(REAL x, REAL y, REAL width, REAL height,
\r
86 REAL startAngle, REAL sweepAngle)
\r
88 return updateStatus(DllExports::GdipAddPathArc(nativePath,
\r
89 x, y, width, height, startAngle, sweepAngle));
\r
91 Status AddArc(INT x, INT y, INT width, INT height,
\r
92 REAL startAngle, REAL sweepAngle)
\r
94 return updateStatus(DllExports::GdipAddPathArcI(nativePath,
\r
95 x, y, width, height, startAngle, sweepAngle));
\r
97 Status AddArc(const RectF& rect, REAL startAngle, REAL sweepAngle)
\r
99 return updateStatus(DllExports::GdipAddPathArc(nativePath,
\r
100 rect.X, rect.Y, rect.Width, rect.Height,
\r
101 startAngle, sweepAngle));
\r
103 Status AddArc(const Rect& rect, REAL startAngle, REAL sweepAngle)
\r
105 return updateStatus(DllExports::GdipAddPathArcI(nativePath,
\r
106 rect.X, rect.Y, rect.Width, rect.Height,
\r
107 startAngle, sweepAngle));
\r
109 Status AddBezier(REAL x1, REAL y1, REAL x2, REAL y2,
\r
110 REAL x3, REAL y3, REAL x4, REAL y4)
\r
112 return updateStatus(DllExports::GdipAddPathBezier(nativePath,
\r
113 x1, y1, x2, y2, x3, y3, x4, y4));
\r
115 Status AddBezier(INT x1, INT y1, INT x2, INT y2,
\r
116 INT x3, INT y3, INT x4, INT y4)
\r
118 return updateStatus(DllExports::GdipAddPathBezierI(nativePath,
\r
119 x1, y1, x2, y2, x3, y3, x4, y4));
\r
121 Status AddBezier(const PointF& pt1, const PointF& pt2,
\r
122 const PointF& pt3, const PointF& pt4)
\r
124 return updateStatus(DllExports::GdipAddPathBezier(nativePath,
\r
125 pt1.X, pt1.Y, pt2.X, pt2.Y,
\r
126 pt3.X, pt3.Y, pt4.X, pt4.Y));
\r
128 Status AddBezier(const Point& pt1, const Point& pt2,
\r
129 const Point& pt3, const Point& pt4)
\r
131 return updateStatus(DllExports::GdipAddPathBezierI(nativePath,
\r
132 pt1.X, pt1.Y, pt2.X, pt2.Y,
\r
133 pt3.X, pt3.Y, pt4.X, pt4.Y));
\r
135 Status AddBeziers(const PointF *points, INT count)
\r
137 return updateStatus(DllExports::GdipAddPathBeziers(
\r
138 nativePath, points, count));
\r
140 Status AddBeziers(const Point *points, INT count)
\r
142 return updateStatus(DllExports::GdipAddPathBeziersI(
\r
143 nativePath, points, count));
\r
145 Status AddClosedCurve(const PointF *points, INT count)
\r
147 return updateStatus(DllExports::GdipAddPathClosedCurve(
\r
148 nativePath, points, count));
\r
150 Status AddClosedCurve(const Point *points, INT count)
\r
152 return updateStatus(DllExports::GdipAddPathClosedCurveI(
\r
153 nativePath, points, count));
\r
155 Status AddClosedCurve(const PointF *points, INT count, REAL tension)
\r
157 return updateStatus(DllExports::GdipAddPathClosedCurve2(
\r
158 nativePath, points, count, tension));
\r
160 Status AddClosedCurve(const Point *points, INT count, REAL tension)
\r
162 return updateStatus(DllExports::GdipAddPathClosedCurve2I(
\r
163 nativePath, points, count, tension));
\r
165 Status AddCurve(const PointF *points, INT count)
\r
167 return updateStatus(DllExports::GdipAddPathCurve(
\r
168 nativePath, points, count));
\r
170 Status AddCurve(const Point *points, INT count)
\r
172 return updateStatus(DllExports::GdipAddPathCurveI(
\r
173 nativePath, points, count));
\r
175 Status AddCurve(const PointF *points, INT count, REAL tension)
\r
177 return updateStatus(DllExports::GdipAddPathCurve2(
\r
178 nativePath, points, count, tension));
\r
180 Status AddCurve(const Point *points, INT count, REAL tension)
\r
182 return updateStatus(DllExports::GdipAddPathCurve2I(
\r
183 nativePath, points, count, tension));
\r
185 Status AddCurve(const PointF *points, INT count, INT offset,
\r
186 INT numberOfSegments, REAL tension)
\r
188 return updateStatus(DllExports::GdipAddPathCurve3(
\r
189 nativePath, points, count,
\r
190 offset, numberOfSegments, tension));
\r
192 Status AddCurve(const Point *points, INT count, INT offset,
\r
193 INT numberOfSegments, REAL tension)
\r
195 return updateStatus(DllExports::GdipAddPathCurve3I(
\r
196 nativePath, points, count,
\r
197 offset, numberOfSegments, tension));
\r
199 Status AddEllipse(REAL x, REAL y, REAL width, REAL height)
\r
201 return updateStatus(DllExports::GdipAddPathEllipse(nativePath,
\r
202 x, y, width, height));
\r
204 Status AddEllipse(INT x, INT y, INT width, INT height)
\r
206 return updateStatus(DllExports::GdipAddPathEllipseI(nativePath,
\r
207 x, y, width, height));
\r
209 Status AddEllipse(const RectF& rect)
\r
211 return updateStatus(DllExports::GdipAddPathEllipse(nativePath,
\r
212 rect.X, rect.Y, rect.Width, rect.Height));
\r
214 Status AddEllipse(const Rect& rect)
\r
216 return updateStatus(DllExports::GdipAddPathEllipseI(nativePath,
\r
217 rect.X, rect.Y, rect.Width, rect.Height));
\r
219 Status AddLine(REAL x1, REAL y1, REAL x2, REAL y2)
\r
221 return updateStatus(DllExports::GdipAddPathLine(nativePath,
\r
224 Status AddLine(INT x1, INT y1, INT x2, INT y2)
\r
226 return updateStatus(DllExports::GdipAddPathLineI(nativePath,
\r
229 Status AddLine(const PointF& pt1, const PointF& pt2)
\r
231 return updateStatus(DllExports::GdipAddPathLine(nativePath,
\r
232 pt1.X, pt1.Y, pt2.X, pt2.Y));
\r
234 Status AddLine(const Point& pt1, const Point& pt2)
\r
236 return updateStatus(DllExports::GdipAddPathLineI(nativePath,
\r
237 pt1.X, pt1.Y, pt2.X, pt2.Y));
\r
239 Status AddLines(const PointF *points, INT count)
\r
241 return updateStatus(DllExports::GdipAddPathLine2(nativePath,
\r
244 Status AddLines(const Point *points, INT count)
\r
246 return updateStatus(DllExports::GdipAddPathLine2I(nativePath,
\r
249 Status AddPath(const GraphicsPath *addingPath, BOOL connect)
\r
251 return updateStatus(DllExports::GdipAddPathPath(nativePath,
\r
252 addingPath ? addingPath->nativePath : NULL,
\r
255 Status AddPie(REAL x, REAL y, REAL width, REAL height,
\r
256 REAL startAngle, REAL sweepAngle)
\r
258 return updateStatus(DllExports::GdipAddPathPie(nativePath,
\r
259 x, y, width, height, startAngle, sweepAngle));
\r
261 Status AddPie(INT x, INT y, INT width, INT height,
\r
262 REAL startAngle, REAL sweepAngle)
\r
264 return updateStatus(DllExports::GdipAddPathPieI(nativePath,
\r
265 x, y, width, height, startAngle, sweepAngle));
\r
267 Status AddPie(const RectF& rect, REAL startAngle, REAL sweepAngle)
\r
269 return updateStatus(DllExports::GdipAddPathPie(nativePath,
\r
270 rect.X, rect.Y, rect.Width, rect.Height,
\r
271 startAngle, sweepAngle));
\r
273 Status AddPie(const Rect& rect, REAL startAngle, REAL sweepAngle)
\r
275 return updateStatus(DllExports::GdipAddPathPieI(nativePath,
\r
276 rect.X, rect.Y, rect.Width, rect.Height,
\r
277 startAngle, sweepAngle));
\r
279 Status AddPolygon(const PointF *points, INT count)
\r
281 return updateStatus(DllExports::GdipAddPathPolygon(nativePath,
\r
284 Status AddPolygon(const Point *points, INT count)
\r
286 return updateStatus(DllExports::GdipAddPathPolygonI(nativePath,
\r
289 Status AddRectangle(const RectF& rect)
\r
291 return updateStatus(DllExports::GdipAddPathRectangle(nativePath,
\r
292 rect.X, rect.Y, rect.Width, rect.Height));
\r
294 Status AddRectangle(const Rect& rect)
\r
296 return updateStatus(DllExports::GdipAddPathRectangleI(
\r
298 rect.X, rect.Y, rect.Width, rect.Height));
\r
300 Status AddRectangles(const RectF *rects, INT count)
\r
302 return updateStatus(DllExports::GdipAddPathRectangles(
\r
303 nativePath, rects, count));
\r
305 Status AddRectangles(const Rect *rects, INT count)
\r
307 return updateStatus(DllExports::GdipAddPathRectanglesI(
\r
308 nativePath, rects, count));
\r
310 Status AddString(const WCHAR *string, INT length,
\r
311 const FontFamily *family, INT style, REAL emSize,
\r
312 const PointF& origin, const StringFormat *format)
\r
314 RectF layoutRect(origin, SizeF(0.0f, 0.0f));
\r
315 return updateStatus(DllExports::GdipAddPathString(nativePath,
\r
317 family ? family->nativeFontFamily : NULL,
\r
318 style, emSize, &layoutRect,
\r
319 format ? format->nativeStringFormat : NULL));
\r
321 Status AddString(const WCHAR *string, INT length,
\r
322 const FontFamily *family, INT style, REAL emSize,
\r
323 const Point& origin, const StringFormat *format)
\r
325 Rect layoutRect(origin, Size(0, 0));
\r
326 return updateStatus(DllExports::GdipAddPathStringI(nativePath,
\r
328 family ? family->nativeFontFamily : NULL,
\r
329 style, emSize, &layoutRect,
\r
330 format ? format->nativeStringFormat : NULL));
\r
332 Status AddString(const WCHAR *string, INT length,
\r
333 const FontFamily *family, INT style, REAL emSize,
\r
334 const RectF& layoutRect, const StringFormat *format)
\r
336 return updateStatus(DllExports::GdipAddPathString(nativePath,
\r
338 family ? family->nativeFontFamily : NULL,
\r
339 style, emSize, &layoutRect,
\r
340 format ? format->nativeStringFormat : NULL));
\r
342 Status AddString(const WCHAR *string, INT length,
\r
343 const FontFamily *family, INT style, REAL emSize,
\r
344 const Rect& layoutRect, const StringFormat *format)
\r
346 return updateStatus(DllExports::GdipAddPathStringI(nativePath,
\r
348 family ? family->nativeFontFamily : NULL,
\r
349 style, emSize, &layoutRect,
\r
350 format ? format->nativeStringFormat : NULL));
\r
352 Status ClearMarkers()
\r
354 return updateStatus(DllExports::GdipClearPathMarkers(
\r
357 Status CloseAllFigures()
\r
359 return updateStatus(DllExports::GdipClosePathFigures(
\r
362 Status CloseFigure()
\r
364 return updateStatus(DllExports::GdipClosePathFigure(
\r
367 Status Flatten(const Matrix *matrix = NULL,
\r
368 REAL flatness = FlatnessDefault)
\r
370 return updateStatus(DllExports::GdipFlattenPath(nativePath,
\r
371 matrix ? matrix->nativeMatrix : NULL,
\r
374 Status GetBounds(RectF *bounds, const Matrix *matrix = NULL,
\r
375 const Pen *pen = NULL) const
\r
377 return updateStatus(DllExports::GdipGetPathWorldBounds(
\r
378 nativePath, bounds,
\r
379 matrix ? matrix->nativeMatrix : NULL,
\r
380 pen ? pen->nativePen : NULL));
\r
382 Status GetBounds(Rect *bounds, const Matrix *matrix = NULL,
\r
383 const Pen *pen = NULL) const
\r
385 return updateStatus(DllExports::GdipGetPathWorldBoundsI(
\r
386 nativePath, bounds,
\r
387 matrix ? matrix->nativeMatrix : NULL,
\r
388 pen ? pen->nativePen : NULL));
\r
390 FillMode GetFillMode() const
\r
392 FillMode result = FillModeAlternate;
\r
393 updateStatus(DllExports::GdipGetPathFillMode(nativePath,
\r
397 Status GetLastPoint(PointF *lastPoint) const
\r
399 return updateStatus(DllExports::GdipGetPathLastPoint(
\r
400 nativePath, lastPoint));
\r
402 Status GetLastStatus() const
\r
404 Status result = lastStatus;
\r
408 Status GetPathData(PathData *pathData) const
\r
410 if (!pathData) return lastStatus = InvalidParameter;
\r
415 status = updateStatus(DllExports::GdipGetPointCount(
\r
416 nativePath, &count));
\r
417 if (status != Ok) return status;
\r
419 status = updateStatus(pathData->AllocateArrays(count));
\r
420 if (status != Ok) return status;
\r
422 return updateStatus(DllExports::GdipGetPathData(
\r
423 nativePath, (GpPathData*) pathData));
\r
425 Status GetPathPoints(PointF *points, INT count) const
\r
427 return updateStatus(DllExports::GdipGetPathPoints(nativePath,
\r
430 Status GetPathPoints(Point *points, INT count) const
\r
432 return updateStatus(DllExports::GdipGetPathPointsI(nativePath,
\r
435 Status GetPathTypes(BYTE *types, INT count) const
\r
437 return updateStatus(DllExports::GdipGetPathTypes(nativePath,
\r
440 INT GetPointCount() const
\r
443 updateStatus(DllExports::GdipGetPointCount(nativePath,
\r
447 BOOL IsOutlineVisible(REAL x, REAL y, const Pen *pen,
\r
448 const Graphics *g = NULL) const;
\r
449 BOOL IsOutlineVisible(INT x, INT y, const Pen *pen,
\r
450 const Graphics *g = NULL) const;
\r
451 BOOL IsOutlineVisible(const PointF& point, const Pen *pen,
\r
452 const Graphics *g = NULL) const;
\r
453 BOOL IsOutlineVisible(const Point& point, const Pen *pen,
\r
454 const Graphics *g = NULL) const;
\r
455 BOOL IsVisible(REAL x, REAL y, const Graphics *g = NULL) const;
\r
456 BOOL IsVisible(INT x, INT y, const Graphics *g = NULL) const;
\r
457 BOOL IsVisible(const PointF& point, const Graphics *g = NULL) const;
\r
458 BOOL IsVisible(const Point& point, const Graphics *g = NULL) const;
\r
459 Status Outline(const Matrix *matrix = NULL,
\r
460 REAL flatness = FlatnessDefault)
\r
462 return updateStatus(DllExports::GdipWindingModeOutline(
\r
464 matrix ? matrix->nativeMatrix : NULL,
\r
469 return updateStatus(DllExports::GdipResetPath(nativePath));
\r
473 return updateStatus(DllExports::GdipReversePath(nativePath));
\r
475 Status SetFillMode(FillMode fillMode)
\r
477 return updateStatus(DllExports::GdipSetPathFillMode(
\r
478 nativePath, fillMode));
\r
482 return updateStatus(DllExports::GdipSetPathMarker(nativePath));
\r
484 Status StartFigure()
\r
486 return updateStatus(DllExports::GdipStartPathFigure(
\r
489 Status Transform(const Matrix *matrix)
\r
491 return updateStatus(DllExports::GdipTransformPath(
\r
493 matrix ? matrix->nativeMatrix : NULL));
\r
495 Status Warp(const PointF *destPoints, INT count, const RectF& srcRect,
\r
496 const Matrix *matrix = NULL,
\r
497 WarpMode warpMode = WarpModePerspective,
\r
498 REAL flatness = FlatnessDefault)
\r
500 return updateStatus(DllExports::GdipWarpPath(nativePath,
\r
501 matrix ? matrix->nativeMatrix : NULL,
\r
503 srcRect.X, srcRect.Y,
\r
504 srcRect.Width, srcRect.Height,
\r
505 warpMode, flatness));
\r
507 Status Widen(const Pen *pen, const Matrix *matrix = NULL,
\r
508 REAL flatness = FlatnessDefault)
\r
510 return updateStatus(DllExports::GdipWidenPath(nativePath,
\r
511 pen ? pen->nativePen : NULL,
\r
512 matrix ? matrix->nativeMatrix : NULL,
\r
517 GraphicsPath(GpPath *path, Status status):
\r
518 nativePath(path), lastStatus(status) {}
\r
519 GraphicsPath(const GraphicsPath&);
\r
520 GraphicsPath& operator=(const GraphicsPath&);
\r
522 Status updateStatus(Status newStatus) const
\r
524 if (newStatus != Ok) lastStatus = newStatus;
\r
528 GpPath *nativePath;
\r
529 mutable Status lastStatus;
\r
532 class GraphicsPathIterator: public GdiplusBase
\r
535 GraphicsPathIterator(GraphicsPath *path):
\r
536 nativePathIterator(NULL), lastStatus(Ok)
\r
538 lastStatus = DllExports::GdipCreatePathIter(
\r
539 &nativePathIterator,
\r
540 path ? path->nativePath : NULL);
\r
542 ~GraphicsPathIterator()
\r
544 DllExports::GdipDeletePathIter(nativePathIterator);
\r
547 INT CopyData(PointF *points, BYTE *types, INT startIndex, INT endIndex)
\r
550 updateStatus(DllExports::GdipPathIterCopyData(
\r
551 nativePathIterator, &result,
\r
552 points, types, startIndex, endIndex));
\r
555 INT Enumerate(PointF *points, BYTE *types, INT count)
\r
558 updateStatus(DllExports::GdipPathIterEnumerate(
\r
559 nativePathIterator, &result,
\r
560 points, types, count));
\r
563 INT GetCount() const
\r
566 updateStatus(DllExports::GdipPathIterGetCount(
\r
567 nativePathIterator, &result));
\r
570 Status GetLastStatus() const
\r
572 Status result = lastStatus;
\r
576 INT GetSubpathCount() const
\r
579 updateStatus(DllExports::GdipPathIterGetSubpathCount(
\r
580 nativePathIterator, &result));
\r
583 BOOL HasCurve() const
\r
585 BOOL result = FALSE;
\r
586 updateStatus(DllExports::GdipPathIterHasCurve(
\r
587 nativePathIterator, &result));
\r
590 INT NextMarker(INT *startIndex, INT *endIndex)
\r
593 updateStatus(DllExports::GdipPathIterNextMarker(
\r
594 nativePathIterator, &result,
\r
595 startIndex, endIndex));
\r
598 INT NextMarker(GraphicsPath *path)
\r
601 updateStatus(DllExports::GdipPathIterNextMarkerPath(
\r
602 nativePathIterator, &result,
\r
603 path ? path->nativePath : NULL));
\r
606 INT NextPathType(BYTE *pathType, INT *startIndex, INT *endIndex)
\r
609 updateStatus(DllExports::GdipPathIterNextPathType(
\r
610 nativePathIterator, &result,
\r
611 pathType, startIndex, endIndex));
\r
614 INT NextSubpath(INT *startIndex, INT *endIndex, BOOL *isClosed)
\r
617 updateStatus(DllExports::GdipPathIterNextSubpath(
\r
618 nativePathIterator, &result,
\r
619 startIndex, endIndex, isClosed));
\r
622 INT NextSubpath(GraphicsPath *path, BOOL *isClosed)
\r
625 updateStatus(DllExports::GdipPathIterNextSubpathPath(
\r
626 nativePathIterator, &result,
\r
627 path ? path->nativePath : NULL, isClosed));
\r
632 updateStatus(DllExports::GdipPathIterRewind(
\r
633 nativePathIterator));
\r
637 GraphicsPathIterator(GpPathIterator *pathIterator, Status status):
\r
638 nativePathIterator(pathIterator), lastStatus(status) {}
\r
639 GraphicsPathIterator(const GraphicsPathIterator&);
\r
640 GraphicsPathIterator& operator=(const GraphicsPathIterator&);
\r
642 Status updateStatus(Status newStatus) const
\r
644 if (newStatus != Ok) lastStatus = newStatus;
\r
648 GpPathIterator *nativePathIterator;
\r
649 mutable Status lastStatus;
\r
652 class PathGradientBrush: public Brush
\r
655 PathGradientBrush(const PointF *points, INT count,
\r
656 WrapMode wrapMode = WrapModeClamp)
\r
658 GpPathGradient *nativePathGradient = NULL;
\r
659 lastStatus = DllExports::GdipCreatePathGradient(
\r
660 points, count, wrapMode, &nativePathGradient);
\r
661 nativeBrush = nativePathGradient;
\r
663 PathGradientBrush(const Point *points, INT count,
\r
664 WrapMode wrapMode = WrapModeClamp)
\r
666 GpPathGradient *nativePathGradient = NULL;
\r
667 lastStatus = DllExports::GdipCreatePathGradientI(
\r
668 points, count, wrapMode, &nativePathGradient);
\r
669 nativeBrush = nativePathGradient;
\r
671 PathGradientBrush(const GraphicsPath *path)
\r
673 GpPathGradient *nativePathGradient = NULL;
\r
674 lastStatus = DllExports::GdipCreatePathGradientFromPath(
\r
675 path ? path->nativePath : NULL,
\r
676 &nativePathGradient);
\r
677 nativeBrush = nativePathGradient;
\r
679 virtual PathGradientBrush *Clone() const
\r
681 GpBrush *cloneBrush = NULL;
\r
682 Status status = updateStatus(DllExports::GdipCloneBrush(
\r
683 nativeBrush, &cloneBrush));
\r
684 if (status == Ok) {
\r
685 PathGradientBrush *result =
\r
686 new PathGradientBrush(cloneBrush, lastStatus);
\r
688 DllExports::GdipDeleteBrush(cloneBrush);
\r
689 updateStatus(OutOfMemory);
\r
697 Status GetBlend(REAL *blendFactors, REAL *blendPositions,
\r
700 return updateStatus(DllExports::GdipGetPathGradientBlend(
\r
701 (GpPathGradient*) nativeBrush,
\r
702 blendFactors, blendPositions, count));
\r
704 INT GetBlendCount() const
\r
707 updateStatus(DllExports::GdipGetPathGradientBlendCount(
\r
708 (GpPathGradient*) nativeBrush, &result));
\r
711 Status GetCenterColor(Color *color) const
\r
713 return updateStatus(DllExports::GdipGetPathGradientCenterColor(
\r
714 (GpPathGradient*) nativeBrush,
\r
715 color ? &color->Value : NULL));
\r
717 Status GetCenterPoint(PointF *point) const
\r
719 return updateStatus(DllExports::GdipGetPathGradientCenterPoint(
\r
720 (GpPathGradient*) nativeBrush, point));
\r
722 Status GetCenterPoint(Point *point) const
\r
724 return updateStatus(DllExports::GdipGetPathGradientCenterPointI(
\r
725 (GpPathGradient*) nativeBrush, point));
\r
727 Status GetFocusScales(REAL *xScale, REAL *yScale) const
\r
729 return updateStatus(DllExports::GdipGetPathGradientFocusScales(
\r
730 (GpPathGradient*) nativeBrush, xScale, yScale));
\r
732 BOOL GetGammaCorrection() const
\r
734 BOOL result = FALSE;
\r
735 updateStatus(DllExports::GdipGetPathGradientGammaCorrection(
\r
736 (GpPathGradient*) nativeBrush, &result));
\r
739 //Status GetGraphicsPath(GraphicsPath *path) const
\r
741 // // TODO: implement PathGradientBrush::GetGraphicsPath
\r
742 // return updateStatus(NotImplemented);
\r
744 INT GetInterpolationColorCount() const
\r
747 updateStatus(DllExports::GdipGetPathGradientPresetBlendCount(
\r
748 (GpPathGradient*) nativeBrush, &result));
\r
751 Status GetInterpolationColors(Color *presetColors,
\r
752 REAL *blendPositions, INT count) const
\r
754 if (!presetColors || count <= 0)
\r
755 return lastStatus = InvalidParameter;
\r
758 (ARGB*) DllExports::GdipAlloc(count * sizeof(ARGB));
\r
760 return lastStatus = OutOfMemory;
\r
762 Status status = updateStatus(DllExports::GdipGetPathGradientPresetBlend(
\r
763 (GpPathGradient*) nativeBrush,
\r
764 presetArgb, blendPositions, count));
\r
765 for (INT i = 0; i < count; ++i) {
\r
766 presetColors[i].SetValue(presetArgb[i]);
\r
768 DllExports::GdipFree((void*) presetArgb);
\r
771 INT GetPointCount() const
\r
774 updateStatus(DllExports::GdipGetPathGradientPointCount(
\r
775 (GpPathGradient*) nativeBrush, &result));
\r
778 Status GetRectangle(RectF *rect) const
\r
780 return updateStatus(DllExports::GdipGetPathGradientRect(
\r
781 (GpPathGradient*) nativeBrush, rect));
\r
783 Status GetRectangle(Rect *rect) const
\r
785 return updateStatus(DllExports::GdipGetPathGradientRectI(
\r
786 (GpPathGradient*) nativeBrush, rect));
\r
788 INT GetSurroundColorCount() const
\r
791 updateStatus(DllExports::GdipGetPathGradientSurroundColorCount(
\r
792 (GpPathGradient*) nativeBrush, &result));
\r
795 Status GetSurroundColors(Color *colors, INT *count)
\r
797 if (!colors || !count || *count <= 0)
\r
798 return lastStatus = InvalidParameter;
\r
801 (ARGB*) DllExports::GdipAlloc(*count * sizeof(ARGB));
\r
803 return lastStatus = OutOfMemory;
\r
805 Status status = updateStatus(DllExports::GdipGetPathGradientSurroundColorsWithCount(
\r
806 (GpPathGradient*) nativeBrush,
\r
807 colorsArgb, count));
\r
808 for (INT i = 0; i < *count; ++i) {
\r
809 colors[i].SetValue(colorsArgb[i]);
\r
811 DllExports::GdipFree((void*) colorsArgb);
\r
814 Status GetTransform(Matrix *matrix) const
\r
816 return updateStatus(DllExports::GdipGetPathGradientTransform(
\r
817 (GpPathGradient*) nativeBrush,
\r
818 matrix ? matrix->nativeMatrix : NULL));
\r
820 WrapMode GetWrapMode() const
\r
822 WrapMode result = WrapModeTile;
\r
823 updateStatus(DllExports::GdipGetPathGradientWrapMode(
\r
824 (GpPathGradient*) nativeBrush, &result));
\r
827 Status MultiplyTransform(const Matrix *matrix,
\r
828 MatrixOrder order = MatrixOrderPrepend)
\r
830 return updateStatus(DllExports::GdipMultiplyPathGradientTransform(
\r
831 (GpPathGradient*) nativeBrush,
\r
832 matrix ? matrix->nativeMatrix : NULL, order));
\r
834 Status ResetTransform()
\r
836 return updateStatus(DllExports::GdipResetPathGradientTransform(
\r
837 (GpPathGradient*) nativeBrush));
\r
839 Status RotateTransform(REAL angle,
\r
840 MatrixOrder order = MatrixOrderPrepend)
\r
842 return updateStatus(DllExports::GdipRotatePathGradientTransform(
\r
843 (GpPathGradient*) nativeBrush, angle, order));
\r
845 Status ScaleTransform(REAL sx, REAL sy,
\r
846 MatrixOrder order = MatrixOrderPrepend)
\r
848 return updateStatus(DllExports::GdipScalePathGradientTransform(
\r
849 (GpPathGradient*) nativeBrush, sx, sy, order));
\r
851 Status SetBlend(REAL *blendFactors, REAL *blendPositions, INT count)
\r
853 return updateStatus(DllExports::GdipSetPathGradientBlend(
\r
854 (GpPathGradient*) nativeBrush,
\r
855 blendFactors, blendPositions, count));
\r
857 Status SetBlendBellShape(REAL focus, REAL scale = 1.0f)
\r
859 return updateStatus(DllExports::GdipSetPathGradientSigmaBlend(
\r
860 (GpPathGradient*) nativeBrush, focus, scale));
\r
862 Status SetBlendTriangularShape(REAL focus, REAL scale = 1.0f)
\r
864 return updateStatus(DllExports::GdipSetPathGradientLinearBlend(
\r
865 (GpPathGradient*) nativeBrush, focus, scale));
\r
867 Status SetCenterColor(const Color& color)
\r
869 return updateStatus(DllExports::GdipSetPathGradientCenterColor(
\r
870 (GpPathGradient*) nativeBrush,
\r
871 color.GetValue()));
\r
873 Status SetCenterPoint(const PointF& point)
\r
875 return updateStatus(DllExports::GdipSetPathGradientCenterPoint(
\r
876 (GpPathGradient*) nativeBrush, &point));
\r
878 Status SetCenterPoint(const Point& point)
\r
880 return updateStatus(DllExports::GdipSetPathGradientCenterPointI(
\r
881 (GpPathGradient*) nativeBrush, &point));
\r
883 Status SetFocusScales(REAL xScale, REAL yScale)
\r
885 return updateStatus(DllExports::GdipSetPathGradientFocusScales(
\r
886 (GpPathGradient*) nativeBrush, xScale, yScale));
\r
888 Status SetGammaCorrection(BOOL useGammaCorrection)
\r
890 return updateStatus(DllExports::GdipSetPathGradientGammaCorrection(
\r
891 (GpPathGradient*) nativeBrush,
\r
892 useGammaCorrection));
\r
894 //Status SetGraphicsPath(const GraphicsPath *path)
\r
896 // // TODO: implement PathGradientBrush::SetGraphicsPath
\r
897 // return updateStatus(NotImplemented);
\r
899 Status SetInterpolationColors(const Color *presetColors,
\r
900 REAL *blendPositions, INT count)
\r
902 if (!presetColors || count <= 0)
\r
903 return lastStatus = InvalidParameter;
\r
906 (ARGB*) DllExports::GdipAlloc(count * sizeof(ARGB));
\r
908 return lastStatus = OutOfMemory;
\r
909 for (INT i = 0; i < count; ++i) {
\r
910 presetArgb[i] = presetColors[i].GetValue();
\r
913 Status status = updateStatus(DllExports::GdipSetPathGradientPresetBlend(
\r
914 (GpPathGradient*) nativeBrush,
\r
915 presetArgb, blendPositions, count));
\r
916 DllExports::GdipFree((void*) presetArgb);
\r
919 Status SetSurroundColors(const Color *colors, INT *count)
\r
921 if (!colors || !count || *count <= 0)
\r
922 return lastStatus = InvalidParameter;
\r
925 (ARGB*) DllExports::GdipAlloc(*count * sizeof(ARGB));
\r
927 return lastStatus = OutOfMemory;
\r
928 for (INT i = 0; i < *count; ++i) {
\r
929 colorsArgb[i] = colors[i].GetValue();
\r
932 Status status = updateStatus(DllExports::GdipSetPathGradientSurroundColorsWithCount(
\r
933 (GpPathGradient*) nativeBrush,
\r
934 colorsArgb, count));
\r
935 DllExports::GdipFree((void*) colorsArgb);
\r
938 Status SetTransform(const Matrix *matrix)
\r
940 return updateStatus(DllExports::GdipSetPathGradientTransform(
\r
941 (GpPathGradient*) nativeBrush,
\r
942 matrix ? matrix->nativeMatrix : NULL));
\r
944 Status SetWrapMode(WrapMode wrapMode)
\r
946 return updateStatus(DllExports::GdipSetPathGradientWrapMode(
\r
947 (GpPathGradient*) nativeBrush, wrapMode));
\r
949 Status TranslateTransform(REAL dx, REAL dy,
\r
950 MatrixOrder order = MatrixOrderPrepend)
\r
952 return updateStatus(DllExports::GdipTranslatePathGradientTransform(
\r
953 (GpPathGradient*) nativeBrush, dx, dy, order));
\r
957 PathGradientBrush(GpBrush *brush, Status status): Brush(brush, status) {}
\r
958 PathGradientBrush(const PathGradientBrush&);
\r
959 PathGradientBrush& operator=(const PathGradientBrush&);
\r
964 #endif /* __GDIPLUS_PATH_H */
\r