- (CIImage *)NSImage_To_CIImage:(NSImage *)gc_image {
CGImageRef cg_image = [gc_image CGImageForProposedRect:nil
context:nil hints:nil];
CIImage *ci_image = [CIImage imageWithCGImage:cg_image];
return ci_image;
}
- (NSImage *)CIImage_To_NSImage:(CIImage *)ci_image {
// image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(-NSMinX(image.extent), -NSMinY(image.extent))];
NSImage *gc_img = [[NSImage alloc] initWithSize:ci_image.extent.size];
[gc_img lockFocus];
CGFloat org_x = 0;
CGFloat org_y = 0;
CGFloat size_w = gc_img.size.width;
CGFloat size_h = gc_img.size.height;
[ci_image drawInRect:NSMakeRect(org_x, org_y, size_w, size_h) fromRect:ci_image.extent operation:NSCompositingOperationSourceOver fraction:1.f];
[gc_img unlockFocus];
return [gc_img autorelease];
}