mob*_*ofu 5 android canvas bitmap
我在Canvas上绘制了一堆位图,应用了2D变换(android.graphics.Camera和android.graphics.Matrix).如何在Canvas上获取位图的大小/位置?大小将是在Canvas上渲染的位图的边界,位置将是边界的上/左角的坐标.所有位图都是没有alpha通道的常规矩形.
矩阵类有一个mapRect用于此目的的函数:
mapRect(RectF dst, RectF src)
Apply this matrix to the src rectangle, and write the transformed rectangle into dst.
将图像的尺寸作为源(如果您使用整个图像,则将 0,0 表示 x,y),它将为您提供转换后的尺寸作为 dst 矩形。
| 归档时间: |
|
| 查看次数: |
1462 次 |
| 最近记录: |