• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSBezierPath bugs? (Contains point and fill)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBezierPath bugs? (Contains point and fill)


  • Subject: Re: NSBezierPath bugs? (Contains point and fill)
  • From: Ricky Sharp <email@hidden>
  • Date: Wed, 12 Oct 2005 16:48:30 -0500


On Oct 12, 2005, at 2:00 PM, Scott Harper wrote:


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?)

Assuming you have an NSImage that represents the contents of your view, create an image with a size set to the size of your path's bounds. Set the graphics context to draw into your newly created image and use NSBezierPath's setClip API to set up the clipping path. Then draw your original image. Your new image should then only contain pixels within your path; all other pixels should be transparent (or whatever you set the background to be).


___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
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


  • Follow-Ups:
    • Brightness -> Alpha mod? (was "Re: NSBezierPath bugs? (Contains point and fill)")
      • From: Scott Harper <email@hidden>
References: 
 >NSBezierPath bugs? (Contains point and fill) (From: Scott Harper <email@hidden>)
 >Re: NSBezierPath bugs? (Contains point and fill) (From: Andy Armstrong <email@hidden>)
 >Re: NSBezierPath bugs? (Contains point and fill) (From: Scott Harper <email@hidden>)

  • Prev by Date: Localizing a Managed Object Model
  • Next by Date: Re: How to load from templates like in iWork using CoreData?
  • Previous by thread: Re: NSBezierPath bugs? (Contains point and fill)
  • Next by thread: Brightness -> Alpha mod? (was "Re: NSBezierPath bugs? (Contains point and fill)")
  • Index(es):
    • Date
    • Thread