diff --git a/AppKit/CPBezierPath.j b/AppKit/CPBezierPath.j index 908c5ca2a..de90822c4 100644 --- a/AppKit/CPBezierPath.j +++ b/AppKit/CPBezierPath.j @@ -272,6 +272,11 @@ var DefaultLineWidth = 1.0; CGPathAddPath(_path, nil, CGPathWithRoundedRectangleInRect(rect, xRadius, yRadius, YES, YES, YES, YES)); } +- (void)appendBezierPathWithArcFromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint radius:(float)radius +{ + CGPathAddArcToPoint(_path, null, fromPoint.x, fromPoint.y, toPoint.x, toPoint.y, radius); +} + /*! Append the contents of a CPBezierPath object. */ diff --git a/AppKit/CoreGraphics/CGContextCanvas.j b/AppKit/CoreGraphics/CGContextCanvas.j index 5660c9cc3..65deeb0cc 100644 --- a/AppKit/CoreGraphics/CGContextCanvas.j +++ b/AppKit/CoreGraphics/CGContextCanvas.j @@ -129,7 +129,7 @@ function CGContextAddPath(aContext, aPath) break; case kCGPathElementAddArc: _CGContextAddArcCanvas(aContext, element.x, element.y, element.radius, element.startAngle, element.endAngle, element.clockwise); break; - case kCGPathElementAddArcTo: //_CGContextAddArcToPointCanvas(aContext, element.cp1x, element.cp1.y, element.cp2.x, element.cp2y, element.radius); + case kCGPathElementAddArcToPoint: _CGContextAddArcToPointCanvas(aContext, element.p1x, element.p1y, element.p2x, element.p2y, element.radius); break; } } diff --git a/AppKit/CoreGraphics/CGContextVML.j b/AppKit/CoreGraphics/CGContextVML.j index e3b09caf9..66d17d89f 100644 --- a/AppKit/CoreGraphics/CGContextVML.j +++ b/AppKit/CoreGraphics/CGContextVML.j @@ -215,7 +215,7 @@ function CGContextDrawPath(aContext, aMode) COORD(start.x), ',', COORD(start.y), " ", COORD(end.x), ',', COORD(end.y)); break; - case kCGPathElementAddArcTo: break; + case kCGPathElementAddArcToPoint: break; } // TODO: Following is broken for curves due to @@ -332,4 +332,4 @@ function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoin // aContext.buffer += vml.join(""); // else // aContext.DOMElement.innerHTML = vml.join(""); -} \ No newline at end of file +} diff --git a/AppKit/CoreGraphics/CGPath.j b/AppKit/CoreGraphics/CGPath.j index bc0fe4c2f..6d6a77301 100644 --- a/AppKit/CoreGraphics/CGPath.j +++ b/AppKit/CoreGraphics/CGPath.j @@ -118,6 +118,17 @@ function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, function CGPathAddArcToPoint(aPath, aTransform, x1, y1, x2, y2, aRadius) { + var p1 = _CGPointMake(x1, y1), + p2 = _CGPointMake(x2, y2); + + if (aTransform) + { + p1 = _CGPointApplyAffineTransform(p1, aTransform); + p2 = _CGPointApplyAffineTransform(p2, aTransform); + } + + aPath.current = p2; + aPath.elements[aPath.count++] = { type:kCGPathElementAddArcToPoint, p1x:p1.x, p1y:p1.y, p2x:p2.x, p2y:p2.y, radius:aRadius }; } function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y) @@ -186,6 +197,12 @@ function CGPathAddPath(aPath, aTransform, anotherPath) element.endAngle, element.isClockwise); break; + case kCGPathElementAddArcToPoint: CGPathAddArcToPoint(aPath, aTransform, + element.p1x, element.p1y, + element.p2x, element.p2y, + element.radius); + break; + case kCGPathElementAddQuadCurveToPoint: CGPathAddQuadCurveToPoint(aPath, aTransform, element.cpx, element.cpy, element.x, element.y);