Matrix Development Summary in Android

Source: Internet
Author: User

In the development encountered some of the matrix of the place, now this summary, easy to consult later.


Single-finger drag and two-finger scaling for images in ImageView by setting the matrix on ImageView

Core approach:
Imageview.setimagematrix (matrix);
So our focus is to operate a matrix.
The main use of this service is to use the matrix to achieve scaling (scale) and displacement (Translate)


Android picture rotation, scaling, displacement, tilt, symmetry complete example (i)--imageview.setimagematrix (matrix) and matrix

There's nothing new here. The core approach is still Imageview.setimagematrix (matrix);

or the main operation of a matrix. Then set the modified matrix to ImageView.

Here is a custom ImageView inherited from the imageview of the system.

So every time you call the Setimagematrix (matrix) on the custom ImageView, it calls the OnDraw () method


Android picture rotation, scaling, displacement, tilt, symmetry complete example (ii)--bitmap.createbitmap () and matrix

in this example, the main use of Bitmap.createbitmap (...) and the Matrix realizes the rotation, scaling, displacement, and tilt of the image.

the role of the mode and Mimageview.setimagematrix (matrix); is the same.

So:

The rotation, scaling, displacement, tilt and symmetry of the image are achieved using the matrix! Just say the objects are different.

(1) using Imageview.setimagematrix (matrix) to act on ImageView.

Because ImageView shows the picture, The matrix effect can be reflected in the picture

(2) using bitmap.createbitmap (...) Directly acting on the newly generated bitmap


Set,pre,post Call Order of matrix

The main point here is to understand the Matrix's set,pre,post invocation order.

such as sometimes confusing why the pre or post does not work, see this should be understandable


Create a reflection of bitmap

The matrix is also used here.


In the future will be added to the induction.

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.