• 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: Basic Core Animation question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic Core Animation question


  • Subject: Re: Basic Core Animation question
  • From: David Duncan <email@hidden>
  • Date: Mon, 14 Apr 2008 12:24:00 -0700

On Apr 13, 2008, at 12:01 AM, Greg Sabo wrote:

Ah! It compiled. Thank you very much! And thanks to Michael for putting
together the sample project.


Now to get the CALayer to draw a path. Most of the documentation I've seen
suggest to do this with a delegate function, is that correct? Here is the
delegate function I've written (a.k.a. copied from another program):


// ********************************************************************************
- (void)drawLayer:(CALayer *)theLayer
inContext:(CGContextRef)theContext {
CGMutablePathRef thePath = CGPathCreateMutable();


   CGPathMoveToPoint(thePath,NULL,15.0f,15.f);
   CGPathAddCurveToPoint(thePath,
                         NULL,
                         15.f,250.0f,
                         295.0f,250.0f,
                         295.0f,15.0f);

   CGContextBeginPath(theContext);
   CGContextAddPath(theContext, thePath );

   CGContextSetLineWidth(theContext, 1);

CGContextSetRGBStrokeColor(theContext,0.0,0.0,1.0,1.0);


CGContextStrokePath(theContext); } //******************************************************

I'm just seeing the black background right now.
Again, thanks for your help and sorry I'm such a pain :)

Note that this code (by itself) leaks, the mutable path your creating is never released (in this snippet). You actually don't need to do this anyway, you can use CGContextMoveToPoint/CGContextAddCurveToPoint/ etc instead and not have to worry about the memory management issue that using CGPath brings up.
--
David Duncan
Apple DTS Animation and Printing
email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Basic Core Animation question
      • From: "Greg Sabo" <email@hidden>
References: 
 >Basic Core Animation question (From: "Greg Sabo" <email@hidden>)
 >Re: Basic Core Animation question (From: Michael Vannorsdel <email@hidden>)
 >Re: Basic Core Animation question (From: "Greg Sabo" <email@hidden>)
 >Re: Basic Core Animation question (From: Michael Watson <email@hidden>)
 >Re: Basic Core Animation question (From: "Greg Sabo" <email@hidden>)

  • Prev by Date: Re: NSCompositeSourceOver equivalent in Quartz 2D?
  • Next by Date: Re: "hooking" into another app
  • Previous by thread: Re: Basic Core Animation question
  • Next by thread: Re: Basic Core Animation question
  • Index(es):
    • Date
    • Thread