GSColor

From iPhone Development Wiki
Revision as of 06:38, 21 January 2014 by Zaersk (talk | contribs) (+ coherence)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


GSColor is a group of C functions that extends CGColor of CoreGraphics. It provides these tasks:

  • Obtaining the RGBA components of a color.
  • Caching common colors.
  • Blending two colors together.

Example code

CGColor brownColor = GSColorForSystemColor(kGSBrownColor);
CGColor myBlueColor = GSColorCreateColorWithDeviceRGBA(0.2, 0.3, 0.9, 1);
CGColor blendedColor = GSColorCreateBlendedColorWithFraction(brownColor, myBlueColor, 0.25);  // 75% brown + 25% myBlue.
CGFloat blendedRedComponent = GSColorGetRedComponent(blendedColor);

CGColorRelease(myBlueColor);
CGColorRelease(blendedColor);

Header