我想增强UIImage中的阴影,类似于Mac中的阴影:
kCIInputBoostShadowAmountKey是正确使用的密钥吗?
如果是,如何使用?
我可以使用CIFilter和CIColorControls编辑饱和度和亮度:
CIContext *context3 = [CIContext contextWithOptions:nil];
CIFilter *filter = [CIFilter filterWithName:@"CIColorControls"];
[filter setValue:outputImage forKey:kCIInputImageKey];
[filter setValue:@0.3f forKey:kCIInputSaturationKey];
//[filter setValue:@1.0f forKey:kCIInputBoostShadowAmountKey]; this is not working.. since it's not in CIColorControls...
CIImage *outputImage3 = [filter valueForKey:kCIOutputImageKey];
_outputImage.image = [UIImage imageWithCGImage:[context3 createCGImage:outputImage3 fromRect:outputImage3.extent]];
更新:
明白了,是CIHighlightShadowAdjust.但是要设置哪个参数呢?
CIImage *inputImage;
NSNumber *inputRadius;
NSNumber *inputShadowAmount; // this one?
NSNumber *inputHighlightAmount;
NSNumber *_inputRadius;
发布于 2019-08-19 23:01:42
我也在寻找密钥。但是您可以直接使用字符串"inputHighlightAmount“。
let parameters = [
kCIInputImageKey: self,
"inputHighlightAmount": highlight,
"inputShadowAmount": shadow,
] as [String : Any]
let filter = CIFilter(name: "CIHighlightShadowAdjust", parameters: parameters)
https://stackoverflow.com/questions/48399022
复制相似问题