RE: How to draw revolving string in view
RE: How to draw revolving string in view
- Subject: RE: How to draw revolving string in view
- From: "Yu, Min" <email@hidden>
- Date: Wed, 27 Dec 2006 14:59:38 +0800
Dear Ricky:
Thanks you very much, I have resolved this issue by your suggestion!
To Hal
And thank Hal for your warm help.
Best Regards,
Yu Min
-----Original Message-----
From: cocoa-dev-bounces+min.yu=email@hidden [mailto:cocoa-dev-bounces+min.yu=email@hidden] On Behalf Of Ricky Sharp
Sent: 2006年12月27日 12:42
To: Yu, Min
Cc: email@hidden
Subject: Re: How to draw revolving string in view
On Dec 26, 2006, at 8:44 PM, Yu, Min wrote:
> I want draw revolving string in view and the center of string is
> origin, I only find one example at http://developer.apple.com/
> documentation/Cocoa/Conceptual/TextLayout/Tasks/
> ArbitraryTextPath.html , that sample is only revolving by degrees,
> not provide function to set origin, so any one know how to set
> origin or how to calculate origin, please give me some suggestion,
> thank you in advance.
Assuming you're drawing left-justified text, when drawing a string,
its origin will have an x-coordinate of its left-edge and a y-
coordinate being its baseline.
Using that info, you can apply a transformation matrix to do the
right thing.
Or, if the text will not change during the rotation, you could render
the text into an NSImage and use the same techniques to rotate that
image.
See the following example on how to rotate an image (or similar
tranforms to rotate the text directly):
<http://developer.apple.com/samplecode/Transformed_Image/index.html>
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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