2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "gdiplus_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus
);
36 /* make sure path has enough space for len more points */
37 static BOOL
lengthen_path(GpPath
*path
, INT len
)
39 /* initial allocation */
40 if(path
->datalen
== 0){
41 path
->datalen
= len
* 2;
43 path
->pathdata
.Points
= GdipAlloc(path
->datalen
* sizeof(PointF
));
44 if(!path
->pathdata
.Points
) return FALSE
;
46 path
->pathdata
.Types
= GdipAlloc(path
->datalen
);
47 if(!path
->pathdata
.Types
){
48 GdipFree(path
->pathdata
.Points
);
52 /* reallocation, double size of arrays */
53 else if(path
->datalen
- path
->pathdata
.Count
< len
){
54 while(path
->datalen
- path
->pathdata
.Count
< len
)
57 path
->pathdata
.Points
= HeapReAlloc(GetProcessHeap(), 0,
58 path
->pathdata
.Points
, path
->datalen
* sizeof(PointF
));
59 if(!path
->pathdata
.Points
) return FALSE
;
61 path
->pathdata
.Types
= HeapReAlloc(GetProcessHeap(), 0,
62 path
->pathdata
.Types
, path
->datalen
);
63 if(!path
->pathdata
.Types
) return FALSE
;
69 GpStatus WINGDIPAPI
GdipAddPathArc(GpPath
*path
, REAL x1
, REAL y1
, REAL x2
,
70 REAL y2
, REAL startAngle
, REAL sweepAngle
)
72 INT count
, old_count
, i
;
75 return InvalidParameter
;
77 count
= arc2polybezier(NULL
, x1
, y1
, x2
, y2
, startAngle
, sweepAngle
);
81 if(!lengthen_path(path
, count
))
84 old_count
= path
->pathdata
.Count
;
85 arc2polybezier(&path
->pathdata
.Points
[old_count
], x1
, y1
, x2
, y2
,
86 startAngle
, sweepAngle
);
88 for(i
= 0; i
< count
; i
++){
89 path
->pathdata
.Types
[old_count
+ i
] = PathPointTypeBezier
;
92 path
->pathdata
.Types
[old_count
] =
93 (path
->newfigure
? PathPointTypeStart
: PathPointTypeLine
);
94 path
->newfigure
= FALSE
;
95 path
->pathdata
.Count
+= count
;
100 GpStatus WINGDIPAPI
GdipAddPathArcI(GpPath
*path
, INT x1
, INT y1
, INT x2
,
101 INT y2
, REAL startAngle
, REAL sweepAngle
)
103 return GdipAddPathArc(path
,(REAL
)x1
,(REAL
)y1
,(REAL
)x2
,(REAL
)y2
,startAngle
,sweepAngle
);
106 GpStatus WINGDIPAPI
GdipAddPathBezier(GpPath
*path
, REAL x1
, REAL y1
, REAL x2
,
107 REAL y2
, REAL x3
, REAL y3
, REAL x4
, REAL y4
)
112 return InvalidParameter
;
114 if(!lengthen_path(path
, 4))
117 old_count
= path
->pathdata
.Count
;
119 path
->pathdata
.Points
[old_count
].X
= x1
;
120 path
->pathdata
.Points
[old_count
].Y
= y1
;
121 path
->pathdata
.Points
[old_count
+ 1].X
= x2
;
122 path
->pathdata
.Points
[old_count
+ 1].Y
= y2
;
123 path
->pathdata
.Points
[old_count
+ 2].X
= x3
;
124 path
->pathdata
.Points
[old_count
+ 2].Y
= y3
;
125 path
->pathdata
.Points
[old_count
+ 3].X
= x4
;
126 path
->pathdata
.Points
[old_count
+ 3].Y
= y4
;
128 path
->pathdata
.Types
[old_count
] =
129 (path
->newfigure
? PathPointTypeStart
: PathPointTypeLine
);
130 path
->pathdata
.Types
[old_count
+ 1] = PathPointTypeBezier
;
131 path
->pathdata
.Types
[old_count
+ 2] = PathPointTypeBezier
;
132 path
->pathdata
.Types
[old_count
+ 3] = PathPointTypeBezier
;
134 path
->newfigure
= FALSE
;
135 path
->pathdata
.Count
+= 4;
140 GpStatus WINGDIPAPI
GdipAddPathBezierI(GpPath
*path
, INT x1
, INT y1
, INT x2
,
141 INT y2
, INT x3
, INT y3
, INT x4
, INT y4
)
143 return GdipAddPathBezier(path
,(REAL
)x1
,(REAL
)y1
,(REAL
)x2
,(REAL
)y2
,(REAL
)x3
,(REAL
)y3
,
147 GpStatus WINGDIPAPI
GdipAddPathBeziers(GpPath
*path
, GDIPCONST GpPointF
*points
,
152 if(!path
|| !points
|| ((count
- 1) % 3))
153 return InvalidParameter
;
155 if(!lengthen_path(path
, count
))
158 old_count
= path
->pathdata
.Count
;
160 for(i
= 0; i
< count
; i
++){
161 path
->pathdata
.Points
[old_count
+ i
].X
= points
[i
].X
;
162 path
->pathdata
.Points
[old_count
+ i
].Y
= points
[i
].Y
;
163 path
->pathdata
.Types
[old_count
+ i
] = PathPointTypeBezier
;
166 path
->pathdata
.Types
[old_count
] =
167 (path
->newfigure
? PathPointTypeStart
: PathPointTypeLine
);
168 path
->newfigure
= FALSE
;
169 path
->pathdata
.Count
+= count
;
174 GpStatus WINGDIPAPI
GdipAddPathBeziersI(GpPath
*path
, GDIPCONST GpPoint
*points
,
181 if(!points
|| ((count
- 1) % 3))
182 return InvalidParameter
;
184 ptsF
= GdipAlloc(sizeof(GpPointF
) * count
);
188 for(i
= 0; i
< count
; i
++){
189 ptsF
[i
].X
= (REAL
)points
[i
].X
;
190 ptsF
[i
].Y
= (REAL
)points
[i
].Y
;
193 ret
= GdipAddPathBeziers(path
, ptsF
, count
);
199 GpStatus WINGDIPAPI
GdipAddPathCurve2(GpPath
*path
, GDIPCONST GpPointF
*points
, INT count
,
202 INT i
, len_pt
= count
*3-2;
207 if(!path
|| !points
|| count
<= 1)
208 return InvalidParameter
;
210 pt
= GdipAlloc(len_pt
* sizeof(GpPointF
));
214 tension
= tension
* TENSION_CONST
;
216 calc_curve_bezier_endp(points
[0].X
, points
[0].Y
, points
[1].X
, points
[1].Y
,
219 pt
[0].X
= points
[0].X
;
220 pt
[0].Y
= points
[0].Y
;
224 for(i
= 0; i
< count
-2; i
++){
225 calc_curve_bezier(&(points
[i
]), tension
, &x1
, &y1
, &x2
, &y2
);
229 pt
[3*i
+3].X
= points
[i
+1].X
;
230 pt
[3*i
+3].Y
= points
[i
+1].Y
;
235 calc_curve_bezier_endp(points
[count
-1].X
, points
[count
-1].Y
,
236 points
[count
-2].X
, points
[count
-2].Y
, tension
, &x1
, &y1
);
240 pt
[len_pt
-1].X
= points
[count
-1].X
;
241 pt
[len_pt
-1].Y
= points
[count
-1].Y
;
243 stat
= GdipAddPathBeziers(path
, pt
, len_pt
);
250 GpStatus WINGDIPAPI
GdipAddPathEllipse(GpPath
*path
, REAL x
, REAL y
, REAL width
,
253 INT old_count
, numpts
;
256 return InvalidParameter
;
258 if(!lengthen_path(path
, MAX_ARC_PTS
))
261 old_count
= path
->pathdata
.Count
;
262 if((numpts
= arc2polybezier(&path
->pathdata
.Points
[old_count
], x
, y
, width
,
263 height
, 0.0, 360.0)) != MAX_ARC_PTS
){
264 ERR("expected %d points but got %d\n", MAX_ARC_PTS
, numpts
);
268 memset(&path
->pathdata
.Types
[old_count
+ 1], PathPointTypeBezier
,
271 /* An ellipse is an intrinsic figure (always is its own subpath). */
272 path
->pathdata
.Types
[old_count
] = PathPointTypeStart
;
273 path
->pathdata
.Types
[old_count
+ MAX_ARC_PTS
- 1] |= PathPointTypeCloseSubpath
;
274 path
->newfigure
= TRUE
;
275 path
->pathdata
.Count
+= MAX_ARC_PTS
;
280 GpStatus WINGDIPAPI
GdipAddPathEllipseI(GpPath
*path
, INT x
, INT y
, INT width
,
283 return GdipAddPathEllipse(path
,(REAL
)x
,(REAL
)y
,(REAL
)width
,(REAL
)height
);
286 GpStatus WINGDIPAPI
GdipAddPathLine2(GpPath
*path
, GDIPCONST GpPointF
*points
,
292 return InvalidParameter
;
294 if(!lengthen_path(path
, count
))
297 old_count
= path
->pathdata
.Count
;
299 for(i
= 0; i
< count
; i
++){
300 path
->pathdata
.Points
[old_count
+ i
].X
= points
[i
].X
;
301 path
->pathdata
.Points
[old_count
+ i
].Y
= points
[i
].Y
;
302 path
->pathdata
.Types
[old_count
+ i
] = PathPointTypeLine
;
306 path
->pathdata
.Types
[old_count
] = PathPointTypeStart
;
307 path
->newfigure
= FALSE
;
310 path
->pathdata
.Count
+= count
;
315 GpStatus WINGDIPAPI
GdipAddPathLine2I(GpPath
*path
, GDIPCONST GpPoint
*points
, INT count
)
322 return InvalidParameter
;
324 pointsF
= GdipAlloc(sizeof(GpPointF
) * count
);
325 if(!pointsF
) return OutOfMemory
;
327 for(i
= 0;i
< count
; i
++){
328 pointsF
[i
].X
= (REAL
)points
[i
].X
;
329 pointsF
[i
].Y
= (REAL
)points
[i
].Y
;
332 stat
= GdipAddPathLine2(path
, pointsF
, count
);
339 GpStatus WINGDIPAPI
GdipAddPathLine(GpPath
*path
, REAL x1
, REAL y1
, REAL x2
, REAL y2
)
344 return InvalidParameter
;
346 if(!lengthen_path(path
, 2))
349 old_count
= path
->pathdata
.Count
;
351 path
->pathdata
.Points
[old_count
].X
= x1
;
352 path
->pathdata
.Points
[old_count
].Y
= y1
;
353 path
->pathdata
.Points
[old_count
+ 1].X
= x2
;
354 path
->pathdata
.Points
[old_count
+ 1].Y
= y2
;
356 path
->pathdata
.Types
[old_count
] =
357 (path
->newfigure
? PathPointTypeStart
: PathPointTypeLine
);
358 path
->pathdata
.Types
[old_count
+ 1] = PathPointTypeLine
;
360 path
->newfigure
= FALSE
;
361 path
->pathdata
.Count
+= 2;
366 GpStatus WINGDIPAPI
GdipAddPathLineI(GpPath
*path
, INT x1
, INT y1
, INT x2
, INT y2
)
368 return GdipAddPathLine(path
, (REAL
)x1
, (REAL
)y1
, (REAL
)x2
, (REAL
)y2
);
371 GpStatus WINGDIPAPI
GdipAddPathPath(GpPath
*path
, GDIPCONST GpPath
* addingPath
,
374 INT old_count
, count
;
376 if(!path
|| !addingPath
)
377 return InvalidParameter
;
379 old_count
= path
->pathdata
.Count
;
380 count
= addingPath
->pathdata
.Count
;
382 if(!lengthen_path(path
, count
))
385 memcpy(&path
->pathdata
.Points
[old_count
], addingPath
->pathdata
.Points
,
386 count
* sizeof(GpPointF
));
387 memcpy(&path
->pathdata
.Types
[old_count
], addingPath
->pathdata
.Types
, count
);
389 if(path
->newfigure
|| !connect
)
390 path
->pathdata
.Types
[old_count
] = PathPointTypeStart
;
392 path
->pathdata
.Types
[old_count
] = PathPointTypeLine
;
394 path
->newfigure
= FALSE
;
395 path
->pathdata
.Count
+= count
;
400 GpStatus WINGDIPAPI
GdipAddPathPolygon(GpPath
*path
, GDIPCONST GpPointF
*points
, INT count
)
404 if(!path
|| !points
|| count
< 3)
405 return InvalidParameter
;
407 if(!lengthen_path(path
, count
))
410 old_count
= path
->pathdata
.Count
;
412 memcpy(&path
->pathdata
.Points
[old_count
], points
, count
*sizeof(GpPointF
));
413 memset(&path
->pathdata
.Types
[old_count
+ 1], PathPointTypeLine
, count
- 1);
415 /* A polygon is an intrinsic figure */
416 path
->pathdata
.Types
[old_count
] = PathPointTypeStart
;
417 path
->pathdata
.Types
[old_count
+ count
- 1] |= PathPointTypeCloseSubpath
;
418 path
->newfigure
= TRUE
;
419 path
->pathdata
.Count
+= count
;
424 GpStatus WINGDIPAPI
GdipAddPathPolygonI(GpPath
*path
, GDIPCONST GpPoint
*points
, INT count
)
430 if(!points
|| count
< 3)
431 return InvalidParameter
;
433 ptf
= GdipAlloc(sizeof(GpPointF
) * count
);
437 for(i
= 0; i
< count
; i
++){
438 ptf
[i
].X
= (REAL
)points
[i
].X
;
439 ptf
[i
].Y
= (REAL
)points
[i
].Y
;
442 status
= GdipAddPathPolygon(path
, ptf
, count
);
449 GpStatus WINGDIPAPI
GdipClonePath(GpPath
* path
, GpPath
**clone
)
452 return InvalidParameter
;
454 *clone
= GdipAlloc(sizeof(GpPath
));
455 if(!*clone
) return OutOfMemory
;
459 (*clone
)->pathdata
.Points
= GdipAlloc(path
->datalen
* sizeof(PointF
));
460 (*clone
)->pathdata
.Types
= GdipAlloc(path
->datalen
);
461 if(!(*clone
)->pathdata
.Points
|| !(*clone
)->pathdata
.Types
){
463 GdipFree((*clone
)->pathdata
.Points
);
464 GdipFree((*clone
)->pathdata
.Types
);
468 memcpy((*clone
)->pathdata
.Points
, path
->pathdata
.Points
,
469 path
->datalen
* sizeof(PointF
));
470 memcpy((*clone
)->pathdata
.Types
, path
->pathdata
.Types
, path
->datalen
);
475 GpStatus WINGDIPAPI
GdipClosePathFigure(GpPath
* path
)
478 return InvalidParameter
;
480 if(path
->pathdata
.Count
> 0){
481 path
->pathdata
.Types
[path
->pathdata
.Count
- 1] |= PathPointTypeCloseSubpath
;
482 path
->newfigure
= TRUE
;
488 GpStatus WINGDIPAPI
GdipClosePathFigures(GpPath
* path
)
493 return InvalidParameter
;
495 for(i
= 1; i
< path
->pathdata
.Count
; i
++){
496 if(path
->pathdata
.Types
[i
] == PathPointTypeStart
)
497 path
->pathdata
.Types
[i
-1] |= PathPointTypeCloseSubpath
;
500 path
->newfigure
= TRUE
;
505 GpStatus WINGDIPAPI
GdipCreatePath(GpFillMode fill
, GpPath
**path
)
508 return InvalidParameter
;
510 *path
= GdipAlloc(sizeof(GpPath
));
511 if(!*path
) return OutOfMemory
;
513 (*path
)->fill
= fill
;
514 (*path
)->newfigure
= TRUE
;
519 GpStatus WINGDIPAPI
GdipCreatePath2(GDIPCONST GpPointF
* points
,
520 GDIPCONST BYTE
* types
, INT count
, GpFillMode fill
, GpPath
**path
)
523 return InvalidParameter
;
525 *path
= GdipAlloc(sizeof(GpPath
));
526 if(!*path
) return OutOfMemory
;
528 (*path
)->pathdata
.Points
= GdipAlloc(count
* sizeof(PointF
));
529 (*path
)->pathdata
.Types
= GdipAlloc(count
);
531 if(!(*path
)->pathdata
.Points
|| !(*path
)->pathdata
.Types
){
532 GdipFree((*path
)->pathdata
.Points
);
533 GdipFree((*path
)->pathdata
.Types
);
538 memcpy((*path
)->pathdata
.Points
, points
, count
* sizeof(PointF
));
539 memcpy((*path
)->pathdata
.Types
, types
, count
);
540 (*path
)->pathdata
.Count
= count
;
541 (*path
)->datalen
= count
;
543 (*path
)->fill
= fill
;
544 (*path
)->newfigure
= TRUE
;
549 GpStatus WINGDIPAPI
GdipCreatePath2I(GDIPCONST GpPoint
* points
,
550 GDIPCONST BYTE
* types
, INT count
, GpFillMode fill
, GpPath
**path
)
556 ptF
= GdipAlloc(sizeof(GpPointF
)*count
);
558 for(i
= 0;i
< count
; i
++){
559 ptF
[i
].X
= (REAL
)points
[i
].X
;
560 ptF
[i
].Y
= (REAL
)points
[i
].Y
;
563 ret
= GdipCreatePath2(ptF
, types
, count
, fill
, path
);
570 GpStatus WINGDIPAPI
GdipDeletePath(GpPath
*path
)
573 return InvalidParameter
;
575 GdipFree(path
->pathdata
.Points
);
576 GdipFree(path
->pathdata
.Types
);
582 GpStatus WINGDIPAPI
GdipGetPathData(GpPath
*path
, GpPathData
* pathData
)
584 if(!path
|| !pathData
)
585 return InvalidParameter
;
587 /* Only copy data. pathData allocation/freeing controlled by wrapper class.
588 Assumed that pathData is enough wide to get all data - controlled by wrapper too. */
589 memcpy(pathData
->Points
, path
->pathdata
.Points
, sizeof(PointF
) * pathData
->Count
);
590 memcpy(pathData
->Types
, path
->pathdata
.Types
, pathData
->Count
);
595 GpStatus WINGDIPAPI
GdipGetPathFillMode(GpPath
*path
, GpFillMode
*fillmode
)
597 if(!path
|| !fillmode
)
598 return InvalidParameter
;
600 *fillmode
= path
->fill
;
605 GpStatus WINGDIPAPI
GdipGetPathLastPoint(GpPath
* path
, GpPointF
* lastPoint
)
609 if(!path
|| !lastPoint
)
610 return InvalidParameter
;
612 count
= path
->pathdata
.Count
;
614 *lastPoint
= path
->pathdata
.Points
[count
-1];
619 GpStatus WINGDIPAPI
GdipGetPathPoints(GpPath
*path
, GpPointF
* points
, INT count
)
622 return InvalidParameter
;
624 if(count
< path
->pathdata
.Count
)
625 return InsufficientBuffer
;
627 memcpy(points
, path
->pathdata
.Points
, path
->pathdata
.Count
* sizeof(GpPointF
));
632 GpStatus WINGDIPAPI
GdipGetPathPointsI(GpPath
*path
, GpPoint
* points
, INT count
)
639 return InvalidParameter
;
641 ptf
= GdipAlloc(sizeof(GpPointF
)*count
);
642 if(!ptf
) return OutOfMemory
;
644 ret
= GdipGetPathPoints(path
,ptf
,count
);
646 for(i
= 0;i
< count
;i
++){
647 points
[i
].X
= roundr(ptf
[i
].X
);
648 points
[i
].Y
= roundr(ptf
[i
].Y
);
655 GpStatus WINGDIPAPI
GdipGetPathTypes(GpPath
*path
, BYTE
* types
, INT count
)
658 return InvalidParameter
;
660 if(count
< path
->pathdata
.Count
)
661 return InsufficientBuffer
;
663 memcpy(types
, path
->pathdata
.Types
, path
->pathdata
.Count
);
668 /* Windows expands the bounding box to the maximum possible bounding box
669 * for a given pen. For example, if a line join can extend past the point
670 * it's joining by x units, the bounding box is extended by x units in every
671 * direction (even though this is too conservative for most cases). */
672 GpStatus WINGDIPAPI
GdipGetPathWorldBounds(GpPath
* path
, GpRectF
* bounds
,
673 GDIPCONST GpMatrix
*matrix
, GDIPCONST GpPen
*pen
)
675 GpPointF
* points
, temp_pts
[4];
677 REAL path_width
= 1.0, width
, height
, temp
, low_x
, low_y
, high_x
, high_y
;
679 /* Matrix and pen can be null. */
681 return InvalidParameter
;
683 /* If path is empty just return. */
684 count
= path
->pathdata
.Count
;
686 bounds
->X
= bounds
->Y
= bounds
->Width
= bounds
->Height
= 0.0;
690 points
= path
->pathdata
.Points
;
692 low_x
= high_x
= points
[0].X
;
693 low_y
= high_y
= points
[0].Y
;
695 for(i
= 1; i
< count
; i
++){
696 low_x
= min(low_x
, points
[i
].X
);
697 low_y
= min(low_y
, points
[i
].Y
);
698 high_x
= max(high_x
, points
[i
].X
);
699 high_y
= max(high_y
, points
[i
].Y
);
702 width
= high_x
- low_x
;
703 height
= high_y
- low_y
;
705 /* This looks unusual but it's the only way I can imitate windows. */
707 temp_pts
[0].X
= low_x
;
708 temp_pts
[0].Y
= low_y
;
709 temp_pts
[1].X
= low_x
;
710 temp_pts
[1].Y
= high_y
;
711 temp_pts
[2].X
= high_x
;
712 temp_pts
[2].Y
= high_y
;
713 temp_pts
[3].X
= high_x
;
714 temp_pts
[3].Y
= low_y
;
716 GdipTransformMatrixPoints((GpMatrix
*)matrix
, temp_pts
, 4);
717 low_x
= temp_pts
[0].X
;
718 low_y
= temp_pts
[0].Y
;
720 for(i
= 1; i
< 4; i
++){
721 low_x
= min(low_x
, temp_pts
[i
].X
);
722 low_y
= min(low_y
, temp_pts
[i
].Y
);
726 width
= height
* fabs(matrix
->matrix
[2]) + width
* fabs(matrix
->matrix
[0]);
727 height
= height
* fabs(matrix
->matrix
[3]) + temp
* fabs(matrix
->matrix
[1]);
731 path_width
= pen
->width
/ 2.0;
734 path_width
= max(path_width
, pen
->width
* pen
->miterlimit
/ 2.0);
735 /* FIXME: this should probably also check for the startcap */
736 if(pen
->endcap
& LineCapNoAnchor
)
737 path_width
= max(path_width
, pen
->width
* 2.2);
741 width
+= 2.0 * path_width
;
742 height
+= 2.0 * path_width
;
747 bounds
->Width
= width
;
748 bounds
->Height
= height
;
753 GpStatus WINGDIPAPI
GdipGetPathWorldBoundsI(GpPath
* path
, GpRect
* bounds
,
754 GDIPCONST GpMatrix
*matrix
, GDIPCONST GpPen
*pen
)
759 ret
= GdipGetPathWorldBounds(path
,&boundsF
,matrix
,pen
);
762 bounds
->X
= roundr(boundsF
.X
);
763 bounds
->Y
= roundr(boundsF
.Y
);
764 bounds
->Width
= roundr(boundsF
.Width
);
765 bounds
->Height
= roundr(boundsF
.Height
);
771 GpStatus WINGDIPAPI
GdipGetPointCount(GpPath
*path
, INT
*count
)
774 return InvalidParameter
;
776 *count
= path
->pathdata
.Count
;
781 GpStatus WINGDIPAPI
GdipIsOutlineVisiblePathPointI(GpPath
* path
, INT x
, INT y
,
782 GpPen
*pen
, GpGraphics
*graphics
, BOOL
*result
)
784 return GdipIsOutlineVisiblePathPoint(path
, x
, y
, pen
, graphics
, result
);
787 GpStatus WINGDIPAPI
GdipIsOutlineVisiblePathPoint(GpPath
* path
, REAL x
, REAL y
,
788 GpPen
*pen
, GpGraphics
*graphics
, BOOL
*result
)
793 return InvalidParameter
;
796 FIXME("not implemented\n");
798 return NotImplemented
;
801 GpStatus WINGDIPAPI
GdipIsVisiblePathPointI(GpPath
* path
, INT x
, INT y
, GpGraphics
*graphics
, BOOL
*result
)
803 return GdipIsVisiblePathPoint(path
, x
, y
, graphics
, result
);
806 GpStatus WINGDIPAPI
GdipIsVisiblePathPoint(GpPath
* path
, REAL x
, REAL y
, GpGraphics
*graphics
, BOOL
*result
)
810 if(!path
) return InvalidParameter
;
813 FIXME("not implemented\n");
815 return NotImplemented
;
818 GpStatus WINGDIPAPI
GdipStartPathFigure(GpPath
*path
)
821 return InvalidParameter
;
823 path
->newfigure
= TRUE
;
828 GpStatus WINGDIPAPI
GdipResetPath(GpPath
*path
)
831 return InvalidParameter
;
833 path
->pathdata
.Count
= 0;
834 path
->newfigure
= TRUE
;
835 path
->fill
= FillModeAlternate
;
840 GpStatus WINGDIPAPI
GdipSetPathFillMode(GpPath
*path
, GpFillMode fill
)
843 return InvalidParameter
;
850 GpStatus WINGDIPAPI
GdipTransformPath(GpPath
*path
, GpMatrix
*matrix
)
853 return InvalidParameter
;
855 if(path
->pathdata
.Count
== 0)
858 return GdipTransformMatrixPoints(matrix
, path
->pathdata
.Points
,
859 path
->pathdata
.Count
);
862 GpStatus WINGDIPAPI
GdipAddPathRectangle(GpPath
*path
, REAL x
, REAL y
,
863 REAL width
, REAL height
)
870 if(!path
|| width
< 0.0 || height
< 0.0)
871 return InvalidParameter
;
873 /* make a backup copy of path data */
874 if((retstat
= GdipClonePath(path
, &backup
)) != Ok
)
877 /* rectangle should start as new path */
878 old_new
= path
->newfigure
;
879 path
->newfigure
= TRUE
;
880 if((retstat
= GdipAddPathLine(path
,x
,y
,x
+width
,y
)) != Ok
){
881 path
->newfigure
= old_new
;
890 if((retstat
= GdipAddPathLine2(path
, ptf
, 2)) != Ok
) goto fail
;
891 path
->pathdata
.Types
[path
->pathdata
.Count
-1] |= PathPointTypeCloseSubpath
;
894 GdipDeletePath(backup
);
899 GdipDeletePath(path
);
900 GdipClonePath(backup
, &path
);
901 GdipDeletePath(backup
);
906 GpStatus WINGDIPAPI
GdipAddPathRectangleI(GpPath
*path
, INT x
, INT y
,
907 INT width
, INT height
)
909 return GdipAddPathRectangle(path
,(REAL
)x
,(REAL
)y
,(REAL
)width
,(REAL
)height
);
912 GpStatus WINGDIPAPI
GdipAddPathRectangles(GpPath
*path
, GDIPCONST GpRectF
*rects
, INT count
)
918 /* count == 0 - verified condition */
919 if(!path
|| !rects
|| count
== 0)
920 return InvalidParameter
;
925 /* make a backup copy */
926 if((retstat
= GdipClonePath(path
, &backup
)) != Ok
)
929 for(i
= 0; i
< count
; i
++){
930 if((retstat
= GdipAddPathRectangle(path
,rects
[i
].X
,rects
[i
].Y
,rects
[i
].Width
,rects
[i
].Height
)) != Ok
)
935 GdipDeletePath(backup
);
940 GdipDeletePath(path
);
941 GdipClonePath(backup
, &path
);
942 GdipDeletePath(backup
);
947 GpStatus WINGDIPAPI
GdipAddPathRectanglesI(GpPath
*path
, GDIPCONST GpRect
*rects
, INT count
)
953 if(!rects
|| count
== 0)
954 return InvalidParameter
;
959 rectsF
= GdipAlloc(sizeof(GpRectF
)*count
);
961 for(i
= 0;i
< count
;i
++){
962 rectsF
[i
].X
= (REAL
)rects
[i
].X
;
963 rectsF
[i
].Y
= (REAL
)rects
[i
].Y
;
964 rectsF
[i
].Width
= (REAL
)rects
[i
].Width
;
965 rectsF
[i
].Height
= (REAL
)rects
[i
].Height
;
968 retstat
= GdipAddPathRectangles(path
, rectsF
, count
);
974 GpStatus WINGDIPAPI
GdipSetPathMarker(GpPath
* path
)
979 return InvalidParameter
;
981 count
= path
->pathdata
.Count
;
983 /* set marker flag */
985 path
->pathdata
.Types
[count
-1] |= PathPointTypePathMarker
;
990 GpStatus WINGDIPAPI
GdipClearPathMarkers(GpPath
* path
)
996 return InvalidParameter
;
998 count
= path
->pathdata
.Count
;
1000 for(i
= 0; i
< count
- 1; i
++){
1001 path
->pathdata
.Types
[i
] &= ~PathPointTypePathMarker
;