Używanie CIImage z CIColor w CIFilterze: uzyskiwanie pustego obrazu

Próbuję utworzyć CIFilter z trybem mieszania (jak nakładka lub mnożenie). Odpowiedni kod:

// Let's try a filter here
// Get the data
NSData *imageData = UIImageJPEGRepresentation(image, 0.85);
// Create a CI Image
CIImage *beginImage = [CIImage imageWithData:imageData];
CIImage *overlay = [CIImage imageWithColor:[CIColor colorWithRed:0.7 green:0.75 blue:0.9 alpha:0.75]];
// Create a context
CIContext *context = [CIContext contextWithOptions:nil];
// Create filter
CIFilter *filter = [CIFilter filterWithName:@"CIOverlayBlendMode" 
                                  keysAndValues:@"inputImage", beginImage,
                                                @"inputBackgroundImage", overlay,
                                                nil];

Inne filtry działają poprawnie (jak sepia), ale z filtrem, który wymaga klucza „inputBackgroundImage”, otrzymuję pusty / pusty wynik ... więc coś wydaje się być nie tak z moim obrazem tła.

Jak użyć filtra trybu mieszania, umieszczając jednolity kolor na obrazie?

questionAnswers(2)

yourAnswerToTheQuestion