예, 일부 필터는 아직 iOS에서 사용할 수없는 것 같습니다. 문서를 읽을 때도 재미있는 경험을했습니다. 그러나 위의 스피커처럼 코드를 사용하여 iOS 용으로 사용할 수있는 필터를 확인할 수 있습니다. 일부 필터 (예 : Civingette)는 설명서에서 찾지 못했지만 5.1에서 iOS에 사용할 수있는 각 필터의 값 매개 변수를 가져 오려고했습니다.
NSArray *supportedFilters = [CIFilter filterNamesInCategory:kCICategoryBuiltIn];
for (CIFilter *filter in supportedFilters) {
NSString *string = [NSString stringWithFormat:@"%@",[[CIFilter filterWithName:(NSString *)filter] inputKeys]];
NSLog(@"%@ %@", filter, string);
}
응답 : 미래에 당신은 아마 문서를 읽으려면 (또는 누군가가 이미 이었나 알고 당신이 그것에 대해 자세한 내용을보실 수 있습니다) 것을
...
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
)
...
참고. 이전에 언급했듯이 일부 필터에 대한 설명서를 찾지 못했기 때문에이 문제를 해결하기 위해 탐정을 사용하고 있습니다.
- (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);
}
마지막으로 CIVignette 내 고통을 종식하기위한 간단하게 당신을 투표 : 여기
내가 이전의 정보에서 CIVingette 함께있어 예입니다. 왜 속성은 최대 강도가 1이고 최대 반경이 2라고 말합니까 ?? !!! 나는 다른 번호를 시도해야했다. – Meroon