Created
May 29, 2012 13:22
-
-
Save tmdvs/2828360 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the data into a bitmap. | |
[self lockFocus]; | |
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[self bounds]]; | |
[self unlockFocus]; | |
// Make an NSImage from our bitmap. | |
image = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; | |
[image addRepresentation:rep]; | |
NSData * tiffData = [image TIFFRepresentationUsingCompression: NSTIFFCompressionNone factor: 0.0f]; | |
CIImage *backgroundCIImage = [[CIImage alloc] initWithData:tiffData]; | |
CIContext *ciContext = [[NSGraphicsContext currentContext] CIContext]; | |
[ciContext drawImage:backgroundCIImage atPoint:CGPointZero fromRect:someRect]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment