Re: CGShading
Re: CGShading
- Subject: Re: CGShading
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 12 Oct 2004 16:38:42 -0700
On Oct 12, 2004, at 2:31 PM, R. Scott Thompson wrote:
That's why I said "(at least not easily)" :-) You might try using
four radial shadings, one centered at each of the four corners and
set them up to fade to 0 by the time you get to the opposite corner.
That would get something close, but not the same, as the
barycentric shading.
You can't really use axial shadings because an axial shading can
only vary in one direction (i.e. you could get it to fade in the x
direction, but for the barycentric effect, you also want it to fade
in y and you can't do both with CGShading).
Sure you can. You just draw it along a 45-degree vector. See David
Hill's example at:
http://developer.apple.com/samplecode/Cocoa_CG_shading_demo/
Cocoa_CG_shading_demo.html
CGShading wouldn't be very useful if it could only be drawn along the
X or Y axis.
No... You misunderstand. I know that you can rotate an axial shading
any way you like. But once you've chosen a direction for the color
change, the color is constant at each point along any given line that
is perpendicular to that direction.
In contrast, to reproduce the barycentric shading, you would want to
change the alpha of current color both in the direction of the
gradient, and along the line perpendicular to the angle of the
gradient. You can't do both at the same time with CGShading
I'm pretty sure I can reproduce the effect with three axial shadings,
since each RGB component's value in my original code is a simple linear
function of the pixel's distance from the origin.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.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