NSBezierPath and NSAffineTransform
NSBezierPath and NSAffineTransform
- Subject: NSBezierPath and NSAffineTransform
- From: Julien Palmas <email@hidden>
- Date: Thu, 10 Mar 2005 10:05:09 +0900
I am writing an application that will mainly draw a custom view plotting a curve. I've already used bezierpath before, but in a light way. Now, i feel like i need to dive a bit deeper inside ....
My view is binded to a curve model object. The curve model object has the method
- (NSBezierPath *)plot;
As the user is able to resize the view, the range of the points in the curve is [0.0 ; 1.0] so that i can apply an NSAffineTransform to the returned path of - (NSBezierPath *)plot in the drawrect method of the view.
NSBezierPath *curvePlot = [curve plot];
[curvePlot transformUsingAffineTransform:transform];
[curvePlot stroke];
I have several kind of curves. Some plot lines thanks to the lineToPoint method in NSBezierPath, some others plot curves by calculating the coords of a point, creating a NSRect with these coords and then using the [NSBezierPath
appendBezierPathWithRect:....].
The problem is that when i use a rect to add a point to the bezierpath, i have to specify a width and a height. And then, when i use the affinetransform, obviously, the size of the rect also gets scaled and i see big squares instead of seeing small points. This doesn't happen when i use the lineToPoint method, the line stays thin, I assume because of the parameter lineWidth ...
The big issue is that i am novice at plotting curves and maybe the use of a NSRect to plot a point is not the best idea, but i don't seem to find something else.
I wonder how is the lineToPoint working. Even if it is under the hood, there must be some kind of coordinates computing as well, and the plotting all the points in a smart way ?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden