kCIApplyOptionExtent not available on iOS

31 Views Asked by At

I have a custom filter kernel and a custom CIFilter that is written in Objective-C for MacOS. I am trying to use it on iOS.

    - (CIImage *)outputImage
{
    NSParameterAssert(inputImage != nil && [inputImage isKindOfClass:[CIImage class]]);
    

    CGRect imageExtent = inputImage.extent;

    [_resizeFilter setValue:inputImage forKey:kCIInputImageKey];
    [_resizeFilter setValue:@(512/CGRectGetHeight(imageExtent)) forKey:kCIInputScaleKey];
    CIImage* resizedImage = [_resizeFilter valueForKey:kCIOutputImageKey];

    NSMutableDictionary* options = [[NSMutableDictionary alloc] init];

    CGRect resizeImageExtent = resizedImage.extent;
    options[kCIApplyOptionExtent] = @[@(0),@(0),@(CGRectGetWidth(resizeImageExtent)),@(CGRectGetHeight(resizeImageExtent))];

    NSError* error;
    CIImage *outputImage = [CustomFilterKernel applyWithExtent:resizeImageExtent
                                                           inputs:@[resizedImage]
                                                        arguments:@{ Type : @(1)}
                                                            error:&error];

    return outputImage;
}

I am getting an error on kCIApplyOptionExtent saying it is not available on iOS. Is there a way around this?

0

There are 0 best solutions below