• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Attempting to draw upon a CGLayer upon a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Attempting to draw upon a CGLayer upon a NSView
      • From: "Frederick C. Lee" <email@hidden>
References: 
 >Attempting to draw upon a CGLayer upon a NSView (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: Re: is nullify causing an exception
  • Next by Date: New and Updated Cocoa Documents Available
  • Previous by thread: Attempting to draw upon a CGLayer upon a NSView
  • Next by thread: Re: Attempting to draw upon a CGLayer upon a NSView
  • Index(es):
    • Date
    • Thread