Get the measured size and position of the raster image on the canvas after 2D conversion

I have a bunch of bitmap images that I draw on a canvas used with 2D transformation (android.graphics.Camera and android.graphics.Matrix). How to get sizes / positions of raster images on canvas? The size will be the borders of the bitmap displayed on the canvas, and the position will be the coordinates of the top / left corner of the borders. All bitmaps are regular rectangles without an alpha channel.

+5
source share
1 answer

For this purpose, the matrix class has a function 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.

+4

All Articles