gpt4 book ai didi

iphone - CIFilter 集成仅适用于 CISepiaTone

转载 作者:行者123 更新时间:2023-11-29 11:13:05 24 4
gpt4 key购买 nike

以下代码为图像添加了漂亮的棕褐色效果,但是当我选择另一个过滤器时,例如:CIBloom 我根本看不到任何图像。你能帮忙吗?

- (void)drawRect:(CGRect)rect
{
UIImage *megan = [UIImage imageNamed:@"megan.png"];

CIImage *cimage = [[CIImage alloc] initWithImage:megan];

CIFilter *myFilter = [CIFilter filterWithName:@"CISepiaTone"];

[myFilter setDefaults];
[myFilter setValue:cimage forKey:@"inputImage"];
[myFilter setValue:[NSNumber numberWithFloat:0.8f] forKey:@"inputIntensity"];

CIImage *image = [myFilter outputImage];
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgImage = [context createCGImage:image fromRect:image.extent];
UIImage *resultUIImage = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage);

CGRect imageRecht = [[UIScreen mainScreen] bounds];
[resultUIImage drawInRect:imageRecht];
}

根据我的理解,我应该能够只编辑以下行来更改过滤器:

CIFilter *myFilter = [CIFilter filterWithName:@"CIBloom"];
[myFilter setValue:[NSNumber numberWithFloat:10.0f] forKey:@"inputIntensity"];

但是当我这样做时,我在启动应用程序时根本看不到任何图像。

最佳答案

CISepiaTone 适用于 Mac OS X v10.4 及更高版本以及 iOS 5.0 及更高版本,而 CIBloom仅适用于 Mac OS X v10.4 及更高版本。

https://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html

关于iphone - CIFilter 集成仅适用于 CISepiaTone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10635286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com