Created
February 5, 2013 16:06
-
-
Save C4Code/4715421 to your computer and use it in GitHub Desktop.
A filthy example of working with images and filters. This code currently shows a work-in-progress overhaul of C4Image.
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.m | |
// | |
// Created by Travis Kirton. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace { | |
C4Image *img1, *img2, *img3, *img4, *img5, *img6; | |
} | |
-(void)setup { | |
CGPoint orig = CGPointMake(0,320); | |
img1 = [C4Image imageNamed:@"C4Sky"]; | |
img2 = [C4Image imageWithImage:img1]; | |
img2.origin = orig; orig.y += 320; | |
img2.animationDuration = 1.0f; | |
img2.animationOptions = AUTOREVERSE | REPEAT; | |
[img2 colorMatrix:C4RED bias:0.05f]; | |
img3 = [[C4Image alloc] initWithCGImage:img1.CGImage]; | |
img3.origin = orig; orig.x = 400; orig.y = 0; | |
img4 = [[C4Image alloc] initWithUIImage:img2.UIImage]; | |
img4.origin = orig; orig.y += 320; | |
[img2 showOriginalImage]; | |
img5 = [[C4Image alloc] initWithUIImage:[UIImage imageWithCIImage:img4.CIImage]]; | |
img5.origin = orig; orig.y += 320; | |
[img4 hueAdjust:0.5f]; | |
[self.canvas addObjects:@[img1,img2,img3,img4,img5]]; | |
[self listenFor:@"CIHueAdjustComplete" fromObject:img4 andRunMethod:@"test"]; | |
} | |
-(void)test { | |
img6 = [[C4Image alloc] initWithUIImage:[UIImage imageWithCGImage:img4.filteredImage]]; | |
img6.origin = CGPointMake(img5.origin.x, img5.origin.y + 320); | |
img6.animationDuration = 1.0f; | |
[img6 colorInvert]; | |
[self.canvas addImage:img6]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment