RectF r = new RectF(50, 0, 100, 100); Log.d("m1", "-r.left = " + r.left + ", right = " + r.right + ", top = " + r.top + ", bottom = " + r.bottom); Matrix m = new Matrix(); m.setScale(2, 3); m.mapRect(r); Log.d("m1", "-r.left = " + r.left + ", right = " + r.right + ", top = " + r.top + ", bottom = " + r.bottom);
上面这段代码log如下:
D/m1 (20694): -r.left = 50.0, right = 100.0, top = 0.0, bottom = 100.0 D/m1 (20694): -r.left = 100.0, right = 200.0, top = 0.0, bottom = 300.0
所以mapRect是单独对RectF的坐标点进行矩阵变换。
时间: 2024-11-13 14:29:01