我正在尝试链接混合图层并对其进行过滤
(Origin -> Texture1(opacity 30%)/HardLight -> Texture2/SoftLight) => level(45, 0.95, 238) + 饱和度(-100) + 色调(+42)
这是我尝试过的:
编辑:此代码在下面有效,感谢您的回答
// Textures
GPUImagePicture *origin = [[GPUImagePicture alloc] initWithImage:originImage smoothlyScaleOutput:NO];
GPUImagePicture *text1 = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"filter_landscape_vintage_1.png"] smoothlyScaleOutput:NO];
GPUImagePicture *text2 = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"filter_landscape_vintage_2.png"] smoothlyScaleOutput:NO];
// Blend filters
GPUImageHardLightBlendFilter *blendFilter1 = [[GPUImageHardLightBlendFilter alloc] init];
GPUImageSoftLightBlendFilter *blendFilter2 = [[GPUImageSoftLightBlendFilter alloc] init];
// Color filters
GPUImageOpacityFilter *filter1 = [[GPUImageOpacityFilter alloc] init];
[filter1 setOpacity:0.3];
GPUImageLevelsFilter *filter2 = [[GPUImageLevelsFilter alloc] init];
[filter2 setMin:45.0/255.0 gamma:0.95 max:238.0/255.0]; // 45, 0.95, 238
GPUImageSaturationFilter *filter3 = [[GPUImageSaturationFilter alloc] init];
[filter3 setSaturation:0.0];
GPUImageHueFilter *filter4 = [[GPUImageHueFilter alloc] init];
[filter4 setHue:42.0];
// Texture1(opacity 30%)/HardLight
[text1 addTarget:filter1]; // Opacity
[filter1 addTarget:blendFilter1]; // HardLight Blend
// Texture2/SoftLight
[text2 addTarget:blendFilter2]; // SoftLight Blend
// Chain Origin + Texture1 + Texture2
[origin addTarget:blendFilter1];
[blendFilter1 addTarget:blendFilter2];
// Result => level + saturation + hue
[blendFilter2 addTarget:filter2];
[filter2 addTarget:filter3];
[filter3 addTarget:filter4];
// Processing
[origin processImage];
[text1 processImage];
[text2 processImage];
UIImage *output = [filter4 imageFromCurrentlyProcessedOutput];