嘿我在使用CISoftLightBlendMode时出现问题,当我将滤镜应用到图像时,叠加图像不会居中于另一个图像的中心,它只会停留在左下角,因此只覆盖了图像的一小部分通过叠加纹理。
继承我的代码:
UIImage* bg = [UIImage imageNamed:@"Texture.png"];
CIImage* beginImage = [CIImage imageWithCGImage:[image_view.image CGImage]];
CIImage* bgImage = [CIImage imageWithCGImage:bg.CGImage];
context = [CIContext contextWithOptions:nil];
filter = [CIFilter filterWithName:@"CISoftLightBlendMode" keysAndValues: kCIInputImageKey, beginImage,@"inputBackgroundImage",bgImage, nil];
CIImage *outputImage = [filter outputImage];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
UIImage *newImg = [UIImage imageWithCGImage:cgimg];
[Image_View setImage:newImg];