Apple says that CIFilter is available in iOS. However, on my mac I couldn't find an CoreImage framework to link against.
filter An optional Core Image filter object that provides the transition.
@property(retain) CIFilter *filter
i.e. when I try to do something like this, it crashes because CIFilter is unknown:
[transition setFilter:[CIFilter filterWithName:@"CIShapedWaterRipple"]];
I linked against:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import <CoreGraphics/CoreGraphics.h>
The following is an example of how I am generating a filtered UIImage on the iPhone using a CIFilter.
- (UIImage*)sepia
{
CIImage *beginImage = [CIImage imageWithCGImage:[self CGImage]];
CIContext *context = [CIContext contextWithOptions:nil];
CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone"
keysAndValues: kCIInputImageKey, beginImage,
@"inputIntensity", [NSNumber numberWithFloat:0.8], nil];
CIImage *outputImage = [filter outputImage];
CGImageRef cgimg =
[context createCGImage:outputImage fromRect:[outputImage extent]];
UIImage *newImg = [UIImage imageWithCGImage:cgimg];
self = newImg;
CGImageRelease(cgimg);
return self;
}
CIFilter is available starting with iOS 5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With