Re: Decimation - NSBezierPath or something else?
Re: Decimation - NSBezierPath or something else?
- Subject: Re: Decimation - NSBezierPath or something else?
- From: Graham Cox <email@hidden>
- Date: Tue, 09 Aug 2011 15:56:43 +1000
On 09/08/2011, at 3:42 PM, N!K wrote:
> I could not believe that this is a new problem; it had to be recognizable and previously dealt with.
> When a number of points occupy one pixel, something has to be done with them. With the old fashioned CRT, the points would bloom from repeated intensification at one location. Not knowing what that "something" is in NSBezierPath or the rest of the path to today's flat panel screen seems risky.
The thing to understand is that NSBezierPath doesn't know anything about pixels. It's an abstract data structure that describes a path, much as the mathematical concept of a 'line' represents something infinitely thin between two points in some arbitrary coordinate system.
Only when a path is rasterized is the path used to paint pixels. That isn't the job of NSBezierPath. Indeed, I would expect that the low level code that does this does take steps not to repeatedly draw the same pixel if the same path point ends up setting the same pixel. Also, bear in mind that the coordinate system that the path occupies is also completely abstract and resolution independent, so rasterizing to a printer context isn't going to be the same as rasterizing to the screen. Paths are scalable to any degree.
We don't typically have access to the low-level rasterizer code, we just leave it to Core Graphics to handle that. If you do want to do that yourself, you could use a third-party library such as Anti-Grain Geometry (http://www.antigrain.com/) to do it, where you could probably implement the simplifier at the rasterizer level. It's very doubtful that it would speed things up - the rasterizer is still going to have to iterate over all the path's points. Simplifying the path itself is well worthwhile, and can be done to an arbitrary precision (the DP algorithm for example lets you set a control value that affects the amount of simplification). But don't confuse doing this with optimising the path for rasterization.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden