I\'m trying to chaining blended layer and filter it
(Origin -> Texture1(opacity 30%)/HardLight -> Texture2/SoftLight) => level(45, 0.95, 238) + satu
I see a couple of problems:
1) There's probably a typo chaining text1's filters:
[text1 addTarget:filter1]; // Opacity
[text1 addTarget:blendFilter1]; // HardLight Blend
should instead be
[text1 addTarget:filter1]; // Opacity
[filter1 addTarget:blendFilter1]; // HardLight Blend
2) You're chaining filters to text1
and text2
GPUImagePictures but forgot to process them:
// Processing
[origin processImage];
[text1 processImage];
[text2 processImage];
3) UIImage *output = [blendFilter2 imageFromCurrentlyProcessedOutput];
You should call imageFromCurrentlyProcessedOutput
on the last filter of the chain which in your case is the group
filter. I wouldn't necessary use the GPUImageFilterGroup
here which is usually used to create filter subclasses that use existing filters, but instead I simply would chain the last 3 filters to blendFilter2
like this:
...
// Result => level + saturation + hue
[blendFilter2 addTarget:filter2];
[filter2 addTarget:filter3];
[filter3 addTarget:filter4];
// Processing
[origin processImage];
[text1 processImage];
[text2 processImage];
UIImage *output = [filter4 imageFromCurrentlyProcessedOutput];
The full chain would be:
[text1] -> [filter1] \
+-> [blend1] \
[origin] / +-> [blend2] -> [filter2] -> [filter3] -> [filter4]
[text2] /
EDIT:
Watch out with those integer divisions setting min and max here:
[filter2 setMin:45/255 gamma:0.95 max:238/255]; // 45, 0.95, 238
min and max are 0!
[filter2 setMin:45 / 255.0 gamma:0.95 max:238 / 255.0]; // 45, 0.95, 238