• 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: How to draw revolving string in view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw revolving string in view


  • Subject: Re: How to draw revolving string in view
  • From: Ricky Sharp <email@hidden>
  • Date: Tue, 26 Dec 2006 22:41:32 -0600


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


  • Follow-Ups:
    • RE: How to draw revolving string in view
      • From: "Yu, Min" <email@hidden>
References: 
 >How to draw revolving string in view (From: "Yu, Min" <email@hidden>)

  • Prev by Date: How to draw revolving string in view
  • Next by Date: Re: NSSplitView
  • Previous by thread: How to draw revolving string in view
  • Next by thread: RE: How to draw revolving string in view
  • Index(es):
    • Date
    • Thread