Re: Putting an image on a CALayer

2008-10-22 Thread David Duncan
On Oct 22, 2008, at 12:09 AM, Patrick Mau wrote: On 22.10.2008, at 02:54, DKJ wrote: Me again. I've been using this code: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateIm

Re: Putting an image on a CALayer

2008-10-22 Thread Patrick Mau
On 22.10.2008, at 02:54, DKJ wrote: Me again. I've been using this code: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(sour

Re: Putting an image on a CALayer

2008-10-21 Thread DKJ
Me again. I've been using this code: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(source); theView.layer.co

Re: Putting an image on a CALayer

2008-10-21 Thread glenn andreas
On Oct 21, 2008, at 3:13 PM, douglas welton wrote: On Oct 21, 2008, at 4:00 PM, DKJ wrote: OK, I tried this: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(

Re: Putting an image on a CALayer

2008-10-21 Thread douglas welton
On Oct 21, 2008, at 4:00 PM, DKJ wrote: OK, I tried this: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(source);

Re: Putting an image on a CALayer

2008-10-21 Thread DKJ
OK, I tried this: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(source); theView.layer.contents = image; an

Re: Putting an image on a CALayer

2008-10-21 Thread David Duncan
On Oct 21, 2008, at 8:50 AM, Jean-Daniel Dupas wrote: I'd like to put an image stored in a JPEG file onto a CALayer. It seems that I do this by assigning a CGImageRef to its contents property. But how do I get a CGImageRef from a file? Do I make an NSData object from the file and do someth

Re: Putting an image on a CALayer

2008-10-21 Thread glenn andreas
On Oct 21, 2008, at 10:54 AM, Josh Abernathy wrote: Scott Stevenson uses an NSImage category with: - (CGImageRef)cgImage { // I'm open to better ideas. :) NSData* data = [self TIFFRepresentation]; return CreateCGImageFromData(data); } So create an NSImage and

Re: Putting an image on a CALayer

2008-10-21 Thread DKJ
On 21 Oct, 2008, at 08:51, Alex Heinz wrote: then draw the NSImage to the CALayer This is the bit I'm not sure how to do. I see a CALayer contents property, but I can't assign an NSImage to that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple

Re: Putting an image on a CALayer

2008-10-21 Thread Josh Abernathy
Scott Stevenson uses an NSImage category with: - (CGImageRef)cgImage { // I'm open to better ideas. :) NSData* data = [self TIFFRepresentation]; return CreateCGImageFromData(data); } So create an NSImage and use that. On Oct 21, 2008, at 11:46 AM, DKJ wrote: I'

Re: Putting an image on a CALayer

2008-10-21 Thread Jean-Daniel Dupas
Le 21 oct. 08 à 17:46, DKJ a écrit : I'd like to put an image stored in a JPEG file onto a CALayer. It seems that I do this by assigning a CGImageRef to its contents property. But how do I get a CGImageRef from a file? Do I make an NSData object from the file and do something with that?

Re: Putting an image on a CALayer

2008-10-21 Thread Alex Heinz
You could use [[NSImage alloc] initWithContentsOfFile:], and then draw the NSImage to the CALayer. HTH, Alex On Oct 21, 2008, at 11:46 AM, DKJ wrote: I'd like to put an image stored in a JPEG file onto a CALayer. It seems that I do this by assigning a CGImageRef to its contents property.

Putting an image on a CALayer

2008-10-21 Thread DKJ
I'd like to put an image stored in a JPEG file onto a CALayer. It seems that I do this by assigning a CGImageRef to its contents property. But how do I get a CGImageRef from a file? Do I make an NSData object from the file and do something with that? dkj ___