Using Perfectly Clear in iOS is very simiar to using it on OSX - just load the image and correct with a Preset or individual parameters:
- Create engine - this should be done once when the app loads
PFCENGINE *pEngine = PFC_CreateEngine();
- Initialize PFCPARAM
if (bUsePresetFile) {
NSString *path = [[NSBundle mainBundle] pathForResource:@"The_Outdoors"
ofType:@"preset"];
NSError* error = nil;
NSString* content = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:&error];
const char *preset = [content cStringUsingEncoding:NSUTF8StringEncoding];
} else {
}
- Apply Perfectly Clear:
- Build a new UIImage and display or save it:
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL,
pData,
w * h * 4,
MBEReleaseDataCallback);
int bitsPerComponent = 8;
int bitsPerPixel = 32;
int bytesPerRow = 4 * w;
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
CGImageRef imf = CGImageCreate(w,
h,
bitsPerComponent,
bitsPerPixel,
bytesPerRow,
colorSpaceRef,
bitmapInfo,
provider,NULL,NO,renderingIntent);
UIImage *newImage = [UIImage imageWithCGImage:imf];
- and last, cleanup: