Re: Attempting to draw upon a CGLayer upon a NSView
Re: Attempting to draw upon a CGLayer upon a NSView
- Subject: Re: Attempting to draw upon a CGLayer upon a NSView
- From: Scott Thompson <email@hidden>
- Date: Tue, 7 Mar 2006 19:38:00 -0600
On Mar 6, 2006, at 11:44 PM, Frederick C. Lee wrote:
Desired Scenario:
Customize NSView that receives an image and a CGLayer to draw
upon that image.
1) I created a CGLayer context and loaded it into the customize
NSView via an accessor.
2) I load an Image into this view. <-- okay.
3) I can also draw in this view (but not over the image).
Problem: I can't create a layer to draw upon. I tried merely to
dump 'Dark Green'
upon the layer to see if it works. It doesn't.
What am I messing here?
Where to begin...
First of all, you never create a CGLayer. You would have to create
it using CGLayerCreateWithContext. After creating the layer, you
could draw into it in the mouseDown routine if you wanted to by
getting it's CGContext (CGLayerGetContext) and making that the
current context using the methods of NSGraphicsContext.
Then in your drawRect routine you would draw the image and then draw
the layer using CGContextDrawLayerAtPoint.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden