Как добиться этих цепочек фильтров с помощью инфраструктуры GPUImage?

Я пытаюсь связать смешанный слой и отфильтровать его

(Origin -> Texture1 (непрозрачность 30%) / HardLight -> Texture2 / SoftLight) => уровень (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];

Ответы на вопрос(1)

Ваш ответ на вопрос