Quartz 2D Shadings
Last Revision: | Version 1.0, 2007-08-31 Shows how to use CGShading and CGGradient objects to draw simple gradients. |
Build Requirements: | Mac OS X 10.5 and Xcode 3.0 |
Runtime Requirements: | Mac OS X 10.5 |
Quartz 2D Shadings demonstrates how to create gradient fills using both the new CGGradientRef objects introduced in Mac OS X 10.5 and using the older CGShadingRef and CGFunctionRef objects available since Mac OS X 10.2. In this sample, both object types are used to obtain identical results, demonstrating how CGGradientRef objects are easier to use than CGShadingRef objects. In general CGShadingRef objects are more flexible, capable of creating shadings that a CGGradientRef object cannot. If you need a linear gradient, then it is much simpler to use a CGGradientRef object. If you need to create non-linear gradients, or some other kind of custom blending, then CGShadingRef objects will allow you to express such gradients, as they use user specified CGFunctionRef object to generate their colors.
Copyright © 2007 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2007-08-31