0 Replies
      Latest reply on Nov 9, 2019 8:43 AM by edgeoftheatlas
      edgeoftheatlas Level 1 Level 1 (0 points)

        I have a simple Objective C function that I would like to convert to use metal instead, for better performance. I have scoured the internet but can't seem to find much other than swift examples. How can I convert this code to metal for a quick image blur?


        //  Create our blurred image

            CIContext *context = [CIContext contextWithOptions:nil];

            CIImage *inputImage = [CIImage imageWithCGImage:thisImage.CGImage];


            //  Setting up Gaussian Blur

            CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];

            [filter setValue:inputImage forKey:kCIInputImageKey];

            [filter setValue:[NSNumber numberWithFloat:5.0f] forKey:@"inputRadius"];

            CIImage *result = [filter valueForKey:kCIOutputImageKey];

            CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]];


            UIImage *retVal = [UIImage imageWithCGImage:cgImage];


            if (cgImage) {




            return retVal;