In Android, bitmap represents a picture that encapsulates the picture's information.
One, the picture is scaled.
(1) Get Bitmap object
Bitmap Bitmap = Bitmapfactory.decoderesource (Getresources (), r.drawable.a);
(2) Create matrix
Matrix matrix = new Matrix ();
Matrix.postscale (0.5f, 0.5f); Zoom 50%
(3) Create a new bitmap
Bitmap dstbmp = Bitmap.createbitmap (Bitmap, 0, 0, bitmap.getwidth (), Bitmap.getheight (), Matrix, false);
explain the above parameters Public static Bitmap CreateBitmap (Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter)
Source this is the original image that needs to be scaled, and the Matrix object is used to specify the scale (which can also be rotated, expanded, and so on for other operations), and filter does not know what to do.
The 4 parameters of the x, y width,heigjt specify where to scale the original picture, such as a picture of 300x200 (width*height), then passing in 100, 100, 200, 100 means
Gray part scaling, from the original x axis of 100 pixels to the right 200 pixels from the y-axis 100 pixels down 100 pixels.
Android Bitmap Zoom rotate watermark cropping operation