Image processing in Android development

Source: Internet
Author: User

Picture infinite amplification, not blurred, picture moving, imitation micro-letter picture Amplification

Note: The key content of this article is "OOM (out of Memory) exception", with "the start of the screenshot when moving" content, the other parts did not see also can read

Write this program background

See the micro-letter image browsing powerful features, so I wrote one. In principle, it can be enlarged infinitely, but most pixels must have 1 pixels of the original picture, and the smallest should not be less than 1*1 pixels.

Ideas:

Functional anatomy:

Scaling: Micro-letter scaling can be scaled to the user satisfaction range. (Zoom will not exceed Max times, shrink will not exceed min)

Move: When the picture is higher and wider than the screen, you can move the picture to any position. When the height or width is greater than the screen, moving the picture will intercept a picture of a module enlarged full screen display.

The most important thing is that when the picture is enlarged, it does not see the picture become blurred

Anatomy of the Embryonic form:

It is assumed that the system has its own matrix function to control amplification and reduction.

Shrink: Can shrink very small times, when not easy to control multiple (such as 1.25 times times, but the matrix is not so accurate)

Zoom in: But when zoomed out of the screen, Bitmap.createbitmap creates a large graph in memory (or memory that exceeds the system's set value or is wider than the screen), resulting in a lack of RAM or memory.

This program is definitely not possible because of the problem with the above amplification.

Excessive anatomy:

Then there is a scaling method that satisfies the following criteria

One that can be almost exactly reduced to a certain multiple

Second, the memory will not overflow when enlarged

Scaling based interception method come up with the following mobile solution

Bille (X,y) that calculates the position at which a reference point is moved on the diagram when it is zoomed in, width the screen height/multiple

Second, when the reduced graph is within the screen range, then the moving effect is realized by moving the ImageView position.

Scenario: Because zooming is the key to zooming in, you can consider zooming in with an intercept section of the graph * n times does not overflow

Screenshot scheme: First, see the interception of the idea of using the canvas canvas (and then created a Mybitmap Class) can intercept never memory overflow of a magnified map. And the image does not blur (canvas excellent).

Add: OOM (out of Memory) exception

1. Amplification of the implementation of the fuzzy: the use of canvas to obtain the enlarged figure, it can solve the conventional amplification after the fuzzy status quo.

2. The picture does not overflow realization: When canvas enlarges, limits the picture the size does not exceed the screen to be OK.

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.