¡@

Home 

2014/10/15 ¤U¤È 10:05:13

iphone Programming Glossary: colorsarr

CGGradient in an CGPath

http://stackoverflow.com/questions/2563303/cggradient-in-an-cgpath

c CGContextAddPath c path CGContextClip c make a gradient CGColorRef colors topColor bottomColor CFArrayRef colorsArr CFArrayCreate NULL const void colors sizeof colors sizeof CGColorRef kCFTypeArrayCallBacks CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB.. CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGGradientRef gradient CGGradientCreateWithColors colorSpace colorsArr NULL CFRelease colorSpace CFRelease colorsArr Draw a linear gradient from top to bottom CGPoint start ... CGPoint end ..... CGGradientRef gradient CGGradientCreateWithColors colorSpace colorsArr NULL CFRelease colorSpace CFRelease colorsArr Draw a linear gradient from top to bottom CGPoint start ... CGPoint end ... CGContextDrawLinearGradient c gradient start..

How can I tint a UIImage with gradient?

http://stackoverflow.com/questions/8098130/how-can-i-tint-a-uiimage-with-gradient

it for ARC and made it reusable using UIImage's category . Here is it UIImage tintedWithLinearGradientColors NSArray colorsArr CGFloat scale self.scale UIGraphicsBeginImageContext CGSizeMake self.size.width scale self.size.height scale CGContextRef.. scale self.size.height scale CGContextDrawImage context rect self.CGImage Create gradient UIColor colorOne colorsArr objectAtIndex 1 top color UIColor colorTwo colorsArr objectAtIndex 0 bottom color NSArray colors NSArray arrayWithObjects.. context rect self.CGImage Create gradient UIColor colorOne colorsArr objectAtIndex 1 top color UIColor colorTwo colorsArr objectAtIndex 0 bottom color NSArray colors NSArray arrayWithObjects id colorOne.CGColor id colorTwo.CGColor nil CGColorSpaceRef..