Skip navigation.
 
mlRe: CGShading
FROM : R. Scott Thompson
DATE : Tue Oct 12 23:31:32 2004

>> 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.

Scott

--
Macintosh Software Engineering Consulting Services
Visit my resume at <http://homepage.mac.com/easco/RSTResume.html>

Related mailsAuthorDate
mlCGShading Peter Laurens Aug 1, 00:40
mlRe: CGShading Shawn Erickson Aug 1, 00:53
mlRe: CGShading Shawn Erickson Aug 1, 00:59
mlRe: CGShading Shawn Erickson Aug 1, 01:09
mlRe: CGShading Scott Thompson Aug 1, 03:35
mlRe: CGShading Perry Clarke Aug 1, 05:16
mlRe: CGShading Ricky Sharp Aug 1, 16:13
mlRe: CGShading Ricky Sharp Aug 1, 18:27
mlRe: CGShading John C. Randolph Oct 12, 20:38
mlRe: CGShading John C. Randolph Oct 12, 20:48
mlRe: CGShading R. Scott Thompson Oct 12, 21:30
mlRe: CGShading John C. Randolph Oct 12, 22:29
mlRe: CGShading R. Scott Thompson Oct 12, 22:41
mlRe: CGShading John C. Randolph Oct 12, 23:07
mlRe: CGShading R. Scott Thompson Oct 12, 23:31
mlRe: CGShading John C. Randolph Oct 13, 01:38
mlRe: CGShading R. Scott Thompson Oct 13, 03:41
mlRe: CGShading John C. Randolph Oct 14, 00:26