I am trying to sell a bitmap and translate it at every step.
If we look at the following code, I draw the image, translate it and scale it, and then perform the same operations in reverse order to return the original configuration. But after applying the operations, I get the original scaled image (scale factor 1), but the image is transferred to a different position.
Could you indicate the correct method? (In the example above, how do I get to the original configuration?)
protected void onDraw(Canvas canvas) { super.onDraw(canvas); Matrix matrix = new Matrix(); scale = (float)screenWidth/201.0f; matrix.setTranslate(-40, -40); matrix.setScale(scale, scale); canvas.drawBitmap(bitMap, matrix, paint);
source share