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: Chilton Webb <email@hidden>
- Date: Sun, 12 Jun 2005 16:06:43 -0500
Hi Scott,
Thanks for your response.
On Jun 12, 2005, at 12:59 PM, Scott Thompson wrote:
As you move from QuickDraw to Quartz, one of the hardest things to
get used to is the idea that graphics are no longer made up of
pixels any more.
That part was easy. I just assumed that these two very simple, very
old technologies, polygons and paint buckets, had some kind of simple
way to do them in Quartz. I see now that I was quite wrong. Coming to
that realization was the hard part ;-)
In short, it treats the image as a resolution independent tiling of
color samples and generate the pixels from it (on pixel base devices).
It seems to me (obviously wrong again) that this would make filling
an arbitrary area quite simple, and that there would by necessity be
some kind of support for polygons.
Your seed fill, or flood fill, is a pixel level operation. It is
very device dependent. To make it work through Quartz, you are
going to want to take your drawing to a pixel device (like an
offscreen bitmap) and perform the flood fill in that environment.
Unfortunately, once you have done so, you're going to be limiting
the resolution of your image.
Youch. There's really no way to do this in Quartz?
This concept, that you are no longer drawing to the pixels, is a
very, very difficult concept for QuickDraw programmers to get used to.
Actually, it's quite easy. What is hard to get used to is losing
features.
See the section on Paths in the Quartz 2D Programming Guide:
http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/drawingwithquartz2d/
Quartz 2D doesn't have Polygons as an explicit primitive. Instead
you create paths using either CGContextMoveToPoint and
CGContextAddLineToPoint or CGPathMoveToPoint and
CGPathAddLineToPoint. If you want to store a polygon in an
explicit polygon representation then you are going to have to
create, and maintain, your own structure.
Do you know of any example code showing how to do this? It looks like
I should use a path for this, correct?
Thank you very much,
-Chilton
_______________________________________________
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