Hi, I just came across this thread, and I solved a similar problem earlier.
This is the code I ended up using:
NSImage *oldImage;
CALayer *layer;
CGImageRef newImage = [[[oldImage representations] objectAtIndex:0]
CGImage];
[layer setContents:(id)newImage];
It may be too late for this specific s
Hi Matt
I'm not involved in the discussion. I just wanted to thank you for the
complete example,
because I'm following this thread too.
Regards,
Patrick
On 19.09.2008, at 19:48, Matt Long wrote:
Hey Brad,
I re-read my message and realized I was a bit condescending in my
comments. Not su
On Sep 19, 2008, at 10:48 AM, Matt Long wrote:
p.s. I would defer to David Duncan on the CGImageRef creation
overhead. I'm sure he's right. I just didn't have the time to try to
get his code to work. ;-)
I forgot to set the current context :). More complete code here,
although this doesn
Hey Brad,
I re-read my message and realized I was a bit condescending in my
comments. Not sure why I was over-stating things so much. I didn't
think I was in a bad mood, but maybe I was. ;-) Anyhow, sorry about
that.
I'm interested in what you are doing here so I went ahead and wrote a
On Sep 18, 2008, at 3:33 PM, Brad Gibbs wrote:
The PNG is in the main bundle -- in my Resources folder.
You can do this to get a CGImageRef directly. (written in Mail, no
error checking).
CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
(CFStringRef)@"myImage.png", NU
On Sep 18, 2008, at 3:18 PM, Matt Long wrote:
You've got some fundamental issues here.
That doesn't surprise me...
This call in particular:
imageLayer drawLayer:imageLayer inContext:ctx];
It doesn't make sense.
-drawLayer:inContext is a delegate method. You are overriding
drawing funct
The PNG is in the main bundle -- in my Resources folder.
On Sep 18, 2008, at 3:16 PM, David Duncan wrote:
On Sep 18, 2008, at 2:54 PM, Brad Gibbs wrote:
I'm trying to draw an NSImage (a PNG) in a CALayer. The goal is to
create a method that allows me to pass an NSImage as an argument to
You've got some fundamental issues here. This call in particular:
imageLayer drawLayer:imageLayer inContext:ctx];
It doesn't make sense.
-drawLayer:inContext is a delegate method. You are overriding drawing
functionality for the layer in question. Instead you would set the
layer's delegate
On Sep 18, 2008, at 2:54 PM, Brad Gibbs wrote:
I'm trying to draw an NSImage (a PNG) in a CALayer. The goal is to
create a method that allows me to pass an NSImage as an argument to
create a layer-hosting view. I have:
Where is this PNG originating? The answer may mean a simpler (and
po
Hi,
I'm trying to draw an NSImage (a PNG) in a CALayer. The goal is to
create a method that allows me to pass an NSImage as an argument to
create a layer-hosting view. I have:
-(id)drawButton: (NSView *)button withImage:(NSImage *)anImage {
...
// image layer
imageLayer=[CALayer
10 matches
Mail list logo