如何找出旋转后的文本框的坐标
借助 (idml) itemtransform 水平/垂直距离和路径点数组,我可以找出文本框的坐标 (x1,y1)、(x2,y2)、(x3,y3)、(x4,y4)。如果文本框旋转,则项目变换值会发生变化,但路径点数组值相同。我可以通过矩阵 [cos(θ) sin(θ) -sin(θ) cos(θ) 0 0] 找到旋转角度,但我无法获得旋转文本框的确切坐标。文本框如下所示。
普通文本框架
<TextFrame Self="u136" ParentStory="u124" ItemTransform="1 0 0 1 101.72727272727272 -349.41818181818184">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
<PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
旋转文本框架
<TextFrame Self="u136" ParentStory="u124" ItemTransform="0 1 -1 0 320.3805483338268 -125.07900895050204">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
<PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
当我将旋转文本框架的值转换为坐标并在屏幕中绘制时,我没有得到它在原始文本中绘制的确切位置。
谁能帮我找出旋转文本框的坐标。
提前致谢。
With the help of (idml) itemtransform horizontal / vertical distances and path point arrays, I can find out the coordinates of text frame (x1,y1), (x2,y2), (x3,y3), (x4,y4). If the textframe is rotated then item transform values are getting changed, but the path point array values are same. I can find rotation angle by the matrix [cos(θ) sin(θ) -sin(θ) cos(θ) 0 0], But I could not get the exact coordinates of rotated textframe. The textframes are given below.
Normal Text frame
<TextFrame Self="u136" ParentStory="u124" ItemTransform="1 0 0 1 101.72727272727272 -349.41818181818184">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
<PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
Rotated textframe
<TextFrame Self="u136" ParentStory="u124" ItemTransform="0 1 -1 0 320.3805483338268 -125.07900895050204">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="-101.72727272727272 -46.581818181818164" LeftDirection="-101.72727272727272 -46.581818181818164" RightDirection="-101.72727272727272 -46.581818181818164"/>
<PathPointType Anchor="-101.72727272727272 -0.3272727272727103" LeftDirection="-101.72727272727272 -0.3272727272727103" RightDirection="-101.72727272727272 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -0.3272727272727103" LeftDirection="115.9090909090909 -0.3272727272727103" RightDirection="115.9090909090909 -0.3272727272727103"/>
<PathPointType Anchor="115.9090909090909 -46.581818181818164" LeftDirection="115.9090909090909 -46.581818181818164" RightDirection="115.9090909090909 -46.581818181818164"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
When I converted the values of rotated textframe in to coordinates and drawn in a screen then I am not getting the exact position where it drawn in the original.
Can anyone help me to find out the cordinates of rotated textframe.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
TextFrame 的 ItemTransform 属性 (abcdef) 中的值表示一个 2D 空间转换矩阵,用于根据以下矩阵乘法公式从 TextFrame 的内部坐标系转换回父坐标系:
其中 X、Y 是 TextFrame 内部的坐标坐标系,Xparent 和 Yparent 是父(Spread 等)坐标系中对应的。
有关详细信息,请参阅7 坐标系、变换和单位
The values in the TextFrame's ItemTransform property (a b c d e f) represent a 2D-space transformation matrix for transforming from the TextFrame's inner coordinate system back to the parent coordinate system according to the following matrix multiplication formula:
Where X, Y are the coordinates in the TextFrame's inner coordinate system and Xparent and Yparent are the corresponding ones in the parent (Spread, etc.) coordinate system.
For more information see 7 Coordinate Systems, Transformations and Units