标签:style http os 使用 io 文件 for 数据 ar
1
2
3
4
5
|
// 创建基于GPU的CIContext对象 context = [CIContext contextWithOptions: nil ]; // 创建基于CPU的CIContext对象 //context = [CIContext contextWithOptions: [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kCIContextUseSoftwareRenderer]]; |
1
2
3
4
5
6
7
8
|
// 通过图片路径创建CIImage NSString *filePath = [[ NSBundle mainBundle] pathForResource:@ "image" ofType:@ "png" ]; NSURL *fileNameAndPath = [ NSURL fileURLWithPath:filePath]; beginImage = [CIImage imageWithContentsOfURL:fileNameAndPath]; // 通过UIImage对象创建CIImage UIImage *gotImage = ...; beginImage = [CIImage imageWithCGImage:gotImage.CGImage]; |
1
2
3
4
|
// 创建过滤器 filter = [CIFilter filterWithName:@ "CISepiaTone" ]; [filter setValue:beginImage forKey:kCIInputImageKey]; [filter setValue:[ NSNumber numberWithFloat:slideValue] forKey:@ "inputIntensity" ]; |
1
2
3
4
5
|
CIImage *outputImage = [filter outputImage]; CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]]; UIImage *newImg = [UIImage imageWithCGImage:cgimg]; [imgV setImage:newImg]; CGImageRelease(cgimg); |
标签:style http os 使用 io 文件 for 数据 ar
原文地址:http://www.cnblogs.com/geek6/p/3931457.html