Re: NSBezierPath bugs? (Contains point and fill)
Re: NSBezierPath bugs? (Contains point and fill)
- Subject: Re: NSBezierPath bugs? (Contains point and fill)
- From: Scott Harper <email@hidden>
- Date: Wed, 12 Oct 2005 13:00:40 -0600
First, when I iterate through all the points in the rect gotten
from the path's -bounds method and check them to see if the pixel
is within the path -- [path containsPoint:NSMakePoint(x, y)] -- I
will sometimes get several pixels WITHIN the path that do not
register as BEING contained by that path. It's generally several
points inside horizontally, and it often occurs a couple of times
along a given edge. It never happens with columns of pixels,
either. I don't know what could be causing this, though I'm
pretty sure it's not MY fault.
I can't answer your question but I'm curious about something...
You're iterating through /all/ the pixels in the rectangle checking
whether each is inside the polygon? So for a 100x100 bounding
rectangle you're doing 10,000 tests against the polygon? That seems
incredibly inefficient - does it have to be done that way?
Indeed I am, and it DOES seem rather inefficient, though I have no
idea how else to do it. I figured that since it's a one-shot thing
JUST after you let go of the mouse, then it wouldn't be THAT big of
an issue to wait an extra fraction of a second. The time needed DOES
get visibly longer (especially on my poor old G3 400) the larger the
area selected.
Does anyone know of a more efficient way to get this done? Is there
perhaps a method I can use for GRABBING all the pixels within an
NSBezierPath explicitly? (Like [image drawAtPoint:p
fromPath:bezierPath operation:NSCompositeSourceOver]; or something?)
I'm not /just/ concerned about efficiency - chances are if you do
it in a more efficient way the bug you're seeing will disappear too :)
Hopefully you're right! Anyone?
--Scott
(Sorry about the off-post message before... Can I have a setting to
explicitly reply to the list when I click "Reply" in Mail?)
_______________________________________________
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