Question

Quick question. I want to tint a movie dynamically in C4 is there a way I could use C4Image compatible temperatureAndTint with the texture ref of the C4Movie? Or could I build a transparent C4Image and tint it on top of the movie? I have tried both of these and it complains.

Thoughts?

Was it helpful?

Solution

A flat color is the easiest way to tint a movie.

In C4, you can do this by adding a layer over top of the movie and specifying that layer's color. The following code uses a transparent C4RED to tint a movie:

-(void)setup {
    C4Movie *m = [C4Movie movieNamed:@"inception.mov"];
    m.width = self.canvas.width;
    m.shouldAutoplay = YES;
    m.loops = YES;

    C4Shape *tintShape = [C4Shape rect:m.bounds];
    tintShape.lineWidth = 0.0f;
    tintShape.fillColor = [C4RED colorWithAlphaComponent:0.2f];
    [m addShape:tintShape];

    [self.canvas addMovie:m];
}

Applying any other kind of CIFilter to a movie in iOS is really difficult. You'll have to learn how to grab frames on the fly and work with Core Graphics directly to apply filters to individual frames as they come out of a frame buffer. It's a big nasty step going from a flat tint to a CIFilter effect on movies in iOS.

You could also have a look at Brad Larson's GPUImage project, which has its own GPUImageMovie class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top