Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
- Subject: Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
- From: vincent habchi <email@hidden>
- Date: Fri, 9 Apr 2010 07:29:31 +0200
Adam,
> You need to have a current NSGraphicsContext for NSColor (and possibly other) attributes. This is pretty easy, as in the following snippet from my own code:
>
> [NSGraphicsContext saveGraphicsState];
> [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctxt flipped:NO]];
>
> CTFrameDraw(frame, ctxt);
> CGContextFlush(ctxt);
> CFRelease(frame);
>
> [NSGraphicsContext restoreGraphicsState];
Nice, I must admit I hadn't think about NSGraphicsContext at all, having a valid CGContext. I'll try this. Thanks at lot!
Vincent_______________________________________________
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