If drawn with rotation, the xcenter-ybaseline point will be the
center of rotation. So before you draw you must increment the X, Y
values to new values which define the location of a stringshape of
the given height rotated about its center, then draw the stringshape.
I think the incrementation of the X,Y coordinates is something like
this:
DeltaX = L*Sin(Rotation)
DeltaY = L*(1 - Cos(Rotation))
L is the distance from the basepoint center to the "midpoint" of the
stringshape when rotated. There really isn't a definitive property
for L that applies in general, so some experimentation is needed to
get acceptable asthetics with the fonts, sizes, and angles that you
plan to work with.
Here's an example that seems half-way decent for starters on the Mac.
I'm sure it can be improved:
dim s as StringShape = new StringShape
s.Text = "AnyStringforTesting" 'whatever
s.TextFont = "Monoco" 'whatever
s.TextSize = 32 'whatever
s.Rotation = 3.1415926535897931/4 'whatever
s.X = g.Width/2 - (s.TextSize/3)*sin(s.Rotation)
s.Y = g.Height/2 - (s.TextSize/3)*(1 - cos(s.Rotation)) + 5
g.DrawObject s
//draw some reference lines for evaluation if you wish
g.DrawLine g.Width/2, 0, g.Width/2, g.Height 'vertical line at
initial x-center
g.DrawLine 0, g.Height/2, g.Width, g.Height/2
Best regards,
Jack
On May 12, 2006, at 10:55 PM, FreeFL wrote:
Hello!
In a canvas subclass, I draw a stringshape after setting some of
its properties, including Rotation.
How do I set the rotation parameters to be around the xcenter-
ycenter-point of the stringshape instead of its xcenter-ybaseline-
point ?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>