Android Image Rendering (I)-image problems

Source: Internet
Author: User
There are many ways to create image images in Android. Today we are learning!The two methods are as follows:
// Method 1 matrix = new matrix (); matrix. postscale (leftorright, 1, bmp w/2, bmp h/2); // the first two are XY transformations, and the last two are the matrix of the symmetric axis center. posttranslate (x, y); canvas. drawbitmap (bmpluffy [0], matrix, paint); // method 2 // canvas. save (); // canvas. scale (-1, 1, x + bmpluffy [0]. getwidth ()/2, Y + bmpluffy [0]. getheight ()/2); // canvas. drawbitmap (bmpluffy [0], X, Y, paint); // canvas. restore ();

Method 1: Use the matrix method (3x3) matrix: 1. Use the postscale method to center the image with points (bmp w/2, bmp h/2, use x = bmp w/2 as the axis of symmetry to flip. 2. Use posttranslate to move the image to the (x, y) Coordinate Method 2. Flip the canvas (omitted)
Note the following: For the bmp w and bmp h refer to the width and height of the image, the image BMP must be used. getwidth () and BMP. getheight () is obtained. The size displayed on the PC cannot be used. Otherwise, misplacement may occur! ------------------------------------------------------------------------- If you are not familiar with matrix, you can refer to the API documentation or network articles related to matrix.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.