Created
July 31, 2012 05:20
-
-
Save C4Examples/3213947 to your computer and use it in GitHub Desktop.
UIColor HSBA
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
| // | |
| // C4Workspace.h | |
| // Examples | |
| // | |
| // Created by Travis Kirton | |
| // | |
| #import "C4Workspace.h" | |
| @interface C4WorkSpace () | |
| -(void)setupShapes; | |
| -(void)setupLabels; | |
| @end | |
| @implementation C4WorkSpace { | |
| C4Shape *red, *green, *blue; | |
| } | |
| -(void)setup { | |
| [self setupShapes]; | |
| [self setupLabels]; | |
| red.fillColor = [UIColor colorWithHue:0.0 saturation:1.0 brightness:1.0 alpha:1.0]; | |
| green.fillColor = [UIColor colorWithHue:0.33 saturation:1.0 brightness:1.0 alpha:1.0]; | |
| blue.fillColor = [UIColor colorWithHue:0.66 saturation:1.0 brightness:1.0 alpha:1.0]; | |
| } | |
| -(void)setupShapes { | |
| CGRect frame = CGRectMake(0, 0, self.canvas.width*0.9f, self.canvas.height/5.0f); | |
| red = [C4Shape rect:frame]; | |
| green = [C4Shape rect:frame]; | |
| blue = [C4Shape rect:frame]; | |
| red.lineWidth = green.lineWidth = blue.lineWidth = 0.0f; | |
| red.center = CGPointMake(self.canvas.center.x, self.canvas.height/4); | |
| green.center = CGPointMake(self.canvas.center.x, self.canvas.height*2/4); | |
| blue.center = CGPointMake(self.canvas.center.x, self.canvas.height*3/4); | |
| [self.canvas addShape:red]; | |
| [self.canvas addShape:green]; | |
| [self.canvas addShape:blue]; | |
| } | |
| -(void)setupLabels { | |
| C4Font *f = [C4Font fontWithName:@"ArialRoundedMTBold" size:30.0f]; | |
| C4Label *l; | |
| l = [C4Label labelWithText:@"{HSBA} : {0.0,1.0,1.0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = red.center; | |
| [self.canvas addLabel:l]; | |
| l = [C4Label labelWithText:@"{HSBA} : {0.33,1.0,0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = green.center; | |
| [self.canvas addLabel:l]; | |
| l = [C4Label labelWithText:@"{HSBA} : {0.66,1.0,1.0,1.0}" font:f]; | |
| l.textColor = [UIColor whiteColor]; | |
| l.center = blue.center; | |
| [self.canvas addLabel:l]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment