Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, it seems some filters are not available for iOS yet. Had the same fun experience when reading the documentation. You can however check with code to see which filter that is availible for iOS, as above speaker. Some filter for example CIVingette that I didn't find in the documentation, I did this to also get value-parameters for each available filter for iOS on 5.1.</p> <pre><code>NSArray *supportedFilters = [CIFilter filterNamesInCategory:kCICategoryBuiltIn]; for (CIFilter *filter in supportedFilters) { NSString *string = [NSString stringWithFormat:@"%@",[[CIFilter filterWithName:(NSString *)filter] inputKeys]]; NSLog(@"%@ %@", filter, string); } </code></pre> <p>The response:</p> <pre> ... 2012-04-19 14:02:55.597 ImageFiltering[12190:707] CIVibrance ( inputImage, inputAmount ) 2012-04-19 14:02:55.599 ImageFiltering[12190:707] CIVignette ( inputImage, inputIntensity, inputRadius ) 2012-04-19 14:02:55.601 ImageFiltering[12190:707] CIWhitePointAdjust ( inputImage, inputColor ) ... </pre> <p>Note that in the future (or someone already knows were you can read more about it) you probably want to read the documentation. This is just me playing detective to get around it, because I didn't find any documentation on some filters as I mention earlier.</p> <p>Here is an example I got out with CIVingette from previous info:</p> <pre> - (void)displayVingetteFilterWithImage{ // Get image and set it as CIImage NSString *filePath = [[NSBundle mainBundle] pathForResource:@"image_1" ofType:@"jpg"]; NSURL *fileNameAndPath = [NSURL fileURLWithPath:filePath]; CIImage *image = [CIImage imageWithContentsOfURL:fileNameAndPath]; // Create context CIContext *imageContext = [CIContext contextWithOptions:nil]; // Set filter to image, in this case CIVignette, knowing it uses inputImage, inputIntensity and inputRadius from previous log-response. CIFilter *vignette = [CIFilter filterWithName:@"CIVignette"]; [vignette setDefaults]; [vignette setValue: image forKey: @"inputImage"]; [vignette setValue: [NSNumber numberWithFloat: 5.0] forKey: @"inputIntensity"]; [vignette setValue: [NSNumber numberWithFloat: 30.0] forKey: @"inputRadius"]; // Attach the CIImage to CGImageRef and attach it as UIImage CIImage *result = [vignette valueForKey: @"outputImage"]; CGImageRef cgImageRef = [imageContext createCGImage:result fromRect:[result extent]]; UIImage *targetImage = [UIImage imageWithCGImage:cgImageRef]; // Attach UIImage to UIImageView in self.view, also position it, just for fun. UIImageView *imageView = [[UIImageView alloc] initWithImage:targetImage]; [self.view addSubview:imageView]; [imageView setImage:targetImage]; imageView.frame = CGRectMake(0.0, 10.0, imageView.frame.size.width, imageView.frame.size.height); // Release CGImageRef we created earlier. CGImageRelease(cgImageRef); }</pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload