Re: Stumped on paint bucket in Core Image and polygons in Quartz
Re: Stumped on paint bucket in Core Image and polygons in Quartz
- Subject: Re: Stumped on paint bucket in Core Image and polygons in Quartz
- From: Nicko van Someren <email@hidden>
- Date: Sun, 12 Jun 2005 16:18:22 +0100
On 12 Jun 2005, at 06:11, Chilton Webb wrote:
I've been playing with the example Core Image Micro Paint. My
understanding of Quartz leave much to be desired though. How would
I go about implementing a seed fill, like the paint bucket tool in
Photoshop?
I don't think that Quartz provides this sort of fill operation as a
primitive. You will likely have to implement the Flood Fill
algorithm yourself. Google for various discussions of the algorithm;
it's fairly basic. If you want to do anything cute like flood fill
using a pattern I suggest you us a stack based rather than a
recursive version, produce a rendition of the fill area into a mask
image and then use this to stencil in your fill pattern.
While I suggest you initially implement the algorithms to be correct
and only subsequently profile the code and optimise its performance,
I suggest you think carefully about your routine for testing if a
pixel is inside the fill area or not. It will be called at least
once for every pixel inside the area and once for every pixel on the
edge. My past experience showed that it's easy for any function/
method call overhead for this to dwarf the actual cost of the test,
but since it will be entirely implementation dependent there is no
substitute for profiling.
Also, where can I find examples of creating polygons in Quartz?
See the section on Paths in the Quartz 2D Programming Guide:
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/
drawingwithquartz2d/
Nicko
_______________________________________________
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