以对象中心为参考在 Postscript 中旋转

Rotate in Postscript with center of object as reference

假设我在后记中有一个方形对象。如何以正方形的中心而不是正方形的左下角为参考角旋转正方形?

假设您的正方形仍在从其左下角绘制,那么 Ken 的评论给出了总体思路,但您还需要在旋转后撤消平移。

/Sq {0 0 moveto 0 100 lineto 100 100 lineto 100 0 lineto closepath} def

gsave

50 50 translate
45 rotate
-50 -50 translate
Sq stroke

grestore