Re: CGShading
Re: CGShading
- Subject: Re: CGShading
- From: "R. Scott Thompson" <email@hidden>
- Date: Tue, 12 Oct 2004 21:02:18 -0500
I tried that, and was never able to reproduce the result that OpenGL gives; compositing multiple CGShadings produces something similar-but-not-quite the same. Additionally, the clip path in Quartz isn't antialiased, which pretty much ruins any sort of compositing tricks for me.
See old thread: http://www.cocoabuilder.com/archive/message/cocoa/2003/12/9/92421
Of course, if you can draw a quad (or just a triangle) via CGShading with different colors at each corner that interpolate like OpenGL, please post the code!
That you can not do (at least not with arbitrary colors). If you let me specify the colors then I can do it, but if you want to be able to pick any old colors then it won't work. In particular, if you wanted to do a rect with black on one corner and three linearly independent colors (like red, green, and blue) on the other three then it can't be done with CGShading. That's where I was confused by John's example. I assumed the colors at the corners could be specified arbitrarily, but with his shading code they are interdependent.
Bonus points if you can do it with antialiased edges.
Are you sure the clipping path in Quartz is not anti-aliased.
Hang on...
The clipping path is antialiased. I just wrote a small test app that drew a circular path, clipped to it, and then filled a rectangle over the same area. The edges of the circle were antialised:
// code before this translates the origin to the center of a view and scales to a reasonable pixel size
CGContextAddArc(inContext, 0, 0, 1, 0, 2 * pi, true);
CGContextClip(inContext);
CGContextFillRect(inContext, CGRectMake(-1, -1, 2, 2));
Twilight Zone points if you can do it in one pass ;)
One pass with CG, or one pass in general? Does it count if I use my own code to scan convert the triangle into a CGImage and then draw the resulting image with CG? I could really use those twilight zone points.
--
Macintosh Software Engineering Consulting Services
Visit my resume at <http://homepage.mac.com/easco/RSTResume.html>
_______________________________________________
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