For example, the code in Listing 1 draws a square using the rect function, then specifies a change to the coordinate system using translate.
例如,清单1所示代码使用rect函数绘制了一个正方形,然后使用translate修改坐标系统。
Then, you create a new coordinate system that's centered within your display using translate and store this matrix.
然后,您可以使用 translate 创建一个位于显示器中央的新坐标系统。
Next, rotate and store this matrix; then, offset from the current coordinate system with translate (which is applied from the previously rotated and translated matrices), and draw a red ellipse.
接下来,旋转和恢复这个矩阵;然后,使用translate设置与当前坐标系统的偏移量(这是从之前旋转和转换的矩阵应用的),并绘制一个红色椭圆。
应用推荐