GSColor: Difference between revisions

From iPhone Development Wiki
(Created page with '{{occlass|library=GraphicsServices.framework}} GSColor is a group of C functions that extends CGColor of CoreGraphics. It provides these tasks…')
 
(+ coherence)
 
Line 2: Line 2:


[[GSColor]] is a group of C functions that extends [[CGColor]] of [[CoreGraphics.framework|CoreGraphics]]. It provides these tasks:
[[GSColor]] is a group of C functions that extends [[CGColor]] of [[CoreGraphics.framework|CoreGraphics]]. It provides these tasks:
* Obtain the RGBA components of a color.
* Obtaining the RGBA components of a color.
* Caching common colors.
* Caching common colors.
* Blending two colors together.
* Blending two colors together.

Latest revision as of 06:38, 21 January 2014


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