Last active
October 11, 2015 00:08
-
-
Save TheCodeEngine/3772096 to your computer and use it in GitHub Desktop.
Build wit CoreGraphics UIImage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage*) buildSwatch: (int) aBrightness | |
{ | |
CGRect rect = CGRectMake(0.0f, 0.0f, 30.0f, 30.0f); | |
UIGraphicsBeginImageContext(rect.size); | |
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:4.0f]; | |
[[[UIColor blackColor] colorWithAlphaComponent:(float) aBrightness / 10.0f] set]; | |
[path fill]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment