I am new to Core Image and have tried some of the filters. I can get some of the filters to work, but others just refused to work.
For example, I can make the CIGaussianGradient filter work with codes such as this:
CIVector *centerVector = [CIVector vectorWithX:150 Y:150];
CIColor *color0 = [CIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0];
CIColor *color1 = [CIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
NSNumber *radius = [NSNumber numberWithFloat:300.0];
CIImage *theCIImage = [CIFilter filterWithName:@"CIGaussianGradient" keysAndValues:@"inputCenter", centerVector, @"inputColor0", color0, @"inputColor1", color1, @"inputRadius", radius, nil].outputImage;
UIImage *newImage = [UIImage imageWithCIImage: theCIImage];
self.ImgView.image = newImage;
But I cannot get CILinearGradient to work using simiar code, for example:
CIVector *point0 =[CIVector vectorWithX:0 Y:0];
CIVector *point1 =[CIVector vectorWithX:200 Y:200];
CIColor *color0 = [CIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0];
CIColor *color1 = [CIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
CIImage *theCIImage = [CIFilter filterWithName:@"CILinearGradient" keysAndValues:@"inputPoint0", point0, @"inputPoint1", point1, @"inputColor0", color0, @"inputColor1", color1, nil].outputImage;
UIImage *newImage = [UIImage imageWithCIImage: theCIImage];
self.ImgView.image = newImage;
What am I missing?
I am testing it on iOS 6.0.
source
share