SurfaceView, draw an image and reduce the size, rotate the image

I want to draw an image (get from the camera) on the surface. After drawing the image, I want to reduce the size of the image, change the location of the image on the surface image with touch. rotate the image. I'm currently drawing an image on the surface, but as the rest of the task is not being completed. Please help me with someone.

thanks

0
source share
1 answer
public void drawImage(Canvas canvas, Bitmap bitmap, int x, int y, int rotationAngle, float scalingfactor){
        Matrix matrix = new Matrix();
        matrix.postRotate(rotationAngle, bitmap.getWidth()/2, bitmap.getHeight()/2);
        matrix.postScale(scalingfactor, scalingfactor, bitmap.getWidth()/2, bitmap.getHeight()/2);
        matrix.postTranslate(x, y);
        canvas.drawBitmap(bitmap, matrix, null);
    }

. scalingfactor 1.0f , . , 0,5f. rotationAngle 0 360

0

Source: https://habr.com/ru/post/1628819/


All Articles