BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.24k stars 4.61k forks source link

Add GPUImageView into a GPUImageUIElement #2364

Open jamesdunay opened 8 years ago

jamesdunay commented 8 years ago

Hey guys/girls

I'm trying to add a GPUImageView (which is playing a movie) into a GPUImageUIElement.

I've added all the elements that I would like to render to the overlay view. I'm able to see a background color for the view I've added, but the video does not show. I can also add text this way but I was interested to find out if there might be something up with adding a GPUImageView. For what it's worth I've also tried adding a UIImageView with a series of animation images, but still no luck. Thanks for taking a look.

func overlayFilter(target: GPUImageOutput) -> GPUImageFilter {

            let logoElement = GPUImageUIElement(view: overlay)
            let blendFilter = GPUImageAlphaBlendFilter()
            blendFilter.mix = 1.0

            target.addTarget(blendFilter)
            logoElement.addTarget(blendFilter)

            target.frameProcessingCompletionBlock = { (currentFilter, frameTime) in
                print("Updating")
                logoElement?.update() }

            return blendFilter
        }
hezhk3 commented 5 years ago

GPUImageUIElement renders the CALayer into a bitmap context. [layer renderInContext:imageContext]; But GPUImageView's layer is a CAEAGLLayer, which won't render it's content to the context.