Click here to Skip to main content
16,020,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am making an talking pet app for iOS.
I wanna make warped image with xcode5.0, but I could not successfully. I have used such as following codes, but I am not sure it is right way for managing of image for animations.
UIImage * temp = [img resizableImageWithCapInsets:UIEdgeInsetsMake(offset_Y, 0.0f , 0.0f, 0.0f) resizingMode:UIImageResizingModeStretch];

CIImage * imgIN = [CIImage imageWithCGImage:temp.CGImage];
NSNumber *radius = [NSNumber numberWithFloat:5.0f];
NSNumber *scale = [NSNumber numberWithFloat:1.0f];

CGPoint point = CGPointMake(point1.x - self.frame.origin.x ,480 - (point1.y - self.frame.origin.y));
CIVector * center = [CIVector vectorWithCGPoint:point];
CIFilter * filter = [CIFilter filterWithName:@"CIBumpDistortion"];
[filter setValue:imgIN forKey:kCIInputImageKey];
[filter setValue:radius forKey:kCIInputRadiusKey];
[filter setValue:center forKey:kCIInputCenterKey];
[filter setValue:scale forKey:kCIInputScaleKey];
CIImage * filtOutImage = filter.outputImage;
CIContext * ctx = [CIContext contextWithOptions:nil];
CGImageRef createdImage = [ctx createCGImage:filtOutImage fromRect:filtOutImage.extent];
UIImage * finalImage = [UIImage imageWithCGImage:createdImage];
self.image = finalImage;
self.image = temp

IF you have experienced, please help me!!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900