Re: Drawing Arcs
Re: Drawing Arcs
- Subject: Re: Drawing Arcs
- From: "Alastair J.Houghton" <email@hidden>
- Date: Sun, 6 Jul 2003 18:22:47 +0100
On Sunday, July 6, 2003, at 02:50 pm, John Hvrnkvist wrote:
On Sunday, Jul 6, 2003, at 14:11 Europe/Stockholm, Alastair J.Houghton
wrote:
The one thing you *can't* do is to use a transformation to distort a
circular arc, because in Quartz things like line width, dash patterns
etcetera are _geometric_ attributes (on most other systems, Win32
included AFAIK, such things are _cosmetic_ attributes, which means
that they are not affected by geometric transformation; Quartz is a
more advanced graphics subsystem and as such, line styles etcetera
*are* affected by any transformations in effect).
You can just transform the control points of the path itself, can't
you?
Yes, of course. The point I was making was that you can't just change
the co-ordinate space to achieve the desired effect (which you could on
a lot of other systems), because things like line widths would come-out
distorted. You could try applying an NSAffineTransform to an
NSBezierPath containing just a circular arc and then use the
appendBezierPath: selector I suppose... (I hadn't thought of that ;->)
Something like
@implementation NSBezierPath (EllipticArcs)
-(void)appendBezierPathWithArcFromPoint:(NSPoint)corner
toPoint:(NSPoint)target
xRadius:(float)xradius
yRadius:(float)yradius
{
NSBezierPath *myPath = [NSBezierPath bezierPath];
NSAffineTransform *myTransform = [NSAffineTransform transform];
[myPath appendBezierPathWithArcFromPoint:NSMakePoint(corner.x,
(corner.y * xradius) / yradius)
ToPoint:NSMakePoint(target.x, (target.y * xradius) / yradius)
radius:xradius];
[myTransform scaleXBy:1.0 scaleYBy:(yradius / xradius)];
[self appendBezierPath: [myTransform transformBezierPath: myPath]];
}
@end
might very well work.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.