Theocacao
Leopard
Design Element
Comment on "Convert an NSImage to CIImage"
by Qwerty Denzel — Nov 14
Here's slightly shorter:
NSData *tiffData = [image TIFFRepresentation]; CIImage *ciImage = [CIImage imageWithData:tiffData]; CGRect cgRect = [ciImage extent]; NSRect nsRect = NSMakeRect(cgRect.origin.x,\ cgRect.origin.y, cgRect.size.width, cgRect.size.height); if ([self isFlipped]) { CGAffineTransform transform; transform = CGAffineTransformMakeTranslation(0.0,cgRect.size.height); transform = CGAffineTransformScale(transform, 1.0, -1.0); ciImage = [ciImage imageByApplyingTransform:transform]; } [ciImage drawAtPoint:NSZeroPoint fromRect:nsRect operation:NSCompositeSourceOver fraction:1.0];
Back to "Convert an NSImage to CIImage"
Design Element

Copyright © Scott Stevenson 2004-2015