Re: Basic Core Animation question
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