GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

GPUImageScreenBlend with filter chain

Open EfeAcikgoz opened this issue 13 years ago • 1 comments

Hi Brad, first of all I would like to thank you for the great library its really amazing and I really appreciate your hard work on it.

I'm building a filter chain that can have different filters such as brightnessFilter, contrastFilter etc by creating an initial filter and adding a GPUImagePicture to it(image to work on) and add GPUImageView as a target to the last filter and use processImage the GPUImagePicture. These filters are connected to sliders and everything works fine until I use GPUImageScreenBlendFilter to blend the filters with a mask.

I allocate and init the filters beforehand to make sure there are no memory leaks etc but if I do not alloc and init the GPUImageScreenBlendFilter it just draws the result once and does not update again even though a new mask picture and filter are created. If I alloc new GPUImageScreenBlendingFilter, the old one does not get released and causes memory warnings

+ (GPUImageFilter *)gpuImageBlend:(GPUImagePicture *)topImage onPreviousFilters:(GPUImageFilter *)previousFilters usingBlendingFilter:(GPUImageScreenBlendFilter *)blendingFilter{
    blendingFilter = [[GPUImageScreenBlendFilter alloc] init];

    [previousFilters addTarget:blendingFilter];
    [topImage addTarget:blendingFilter];
    return blendingFilter;
}

By the way the blending is the last step of the chain if a mask is selected

EfeAcikgoz avatar Oct 02 '13 15:10 EfeAcikgoz

I found where my leak was. I was cleaning the targets of previous filter but not the top image which was causing newly allocated blending filters to get stacked in it.

EfeAcikgoz avatar Oct 02 '13 23:10 EfeAcikgoz