寻找 post/pre/set Translate(在 Matrix 对象中)的解释以及如何使用它们 [英] Looking for an explanation of post/pre/set Translate (in Matrix object) and how to use them

查看:40
本文介绍了寻找 post/pre/set Translate(在 Matrix 对象中)的解释以及如何使用它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档对于实际发生的情况非常模糊使用这些方法.有人能解释一下 Matrix 如何实际影响它被设置的位图吗?他们在那里使用了 concatenate 一词,但我不清楚该术语如何应用于坐标数据(之前仅将其用于字符串操作).

The documentation is pretty vague as to what is actually happening when these methods are used. Can someone explain how Matrix actually affects the Bitmap that it's being set to? They use the term concatenate in there, but I'm unclear on how that term applies to coordinate data (having only used it in regard to string manipulation before).

推荐答案

set-methods 将用新值替换当前的 Matrix,忽略之前包含的 Matrix.pre 和 post 方法将在当前 Matrix 包含的任何内容之前或之后应用新的转换.

The set-methods will replace the current Matrix with new values, disregarding whatever the Matrix contained before. The pre and post method will apply a new transformation before or after whatever the current Matrix contains.

在这个例子中,旋转将被忽略,因为我们使用的是 set 方法并且 m 将只包含一个平移:

In this example, the rotation will be ignored since we are using the set method and the m will only contain a translation:

矩阵 m = new Matrix();

Matrix m = new Matrix();

m.setRotate(90);

m.setRotate(90);

m.setTranslate(100, 100);

m.setTranslate(100, 100);

在这个例子中,最终的矩阵将是一个平移,然后是一个旋转:

In this example, the final matrix will be a translation followed by a rotation:

矩阵 m = new Matrix();

Matrix m = new Matrix();

m.setTranslate(100, 100);

m.setTranslate(100, 100);

m.postRotate(90);

m.postRotate(90);

在最后一个例子中,最终的矩阵将是一个旋转后跟一个平移:

In the final example, the final matrix will be a rotation followed by a translation:

矩阵 m = new Matrix();

Matrix m = new Matrix();

m.setTranslate(100, 100);

m.setTranslate(100, 100);

m.preRotate(90);

m.preRotate(90);

这篇(相当冗长的)帖子中有更多信息:

There is some more information in this (rather lengthy) post:

http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&ownerUserId=satya&reportId=2898

希望有帮助.

这篇关于寻找 post/pre/set Translate(在 Matrix 对象中)的解释以及如何使用它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆