The picture double-clicks the magnification and the picture size, displays the picture's view size. and the current scale size of the image are related.
In order to avoid the image enlargement too large. Sets the maximum limit for a magnification of scale_limit, which is now 4.
Detailed algorithms such as the following are seen:
Picture width and height are recorded as: Imagew Imageh
The view width and height of the displayed picture are as follows: Vieww VIEWH
A few important proportions are recorded as:
Scale_1 = Vieww/imagew
scale_2 = Viewh/imageh
Scale_3 = Vieww/imageh
Scale_4 = Viewh/imagew
Assuming the width-to-height ratio of the current picture is >2 or <0.5, the magnification zoomrate is computed according to the algorithm such as the following:
(1) The current scale = min (scale_1, scale_2).
(2) zoomrate = min (max (scale_1, scale_2), Max (Scale_3, scale_4));
(3) Assuming zoomrate > scale_limit, then zoomrate = Scale_limit;
(4) Assuming scale >= zoomrate, the result of preserving (1) calculates the Zoomrate value again from step (2), otherwise jumps to (6)
Zoomrate = Max (max (Scale_1, scale_2), Max (Scale_3, scale_4));
(5) Assuming zoomrate > scale_limit, then zoomrate = Scale_limit;
(6) The Zoomrate value is the multiple of the image that should be enlarged.
Assuming the width-to-height ratio of the current picture is <=2 or >=0.5, the magnification zoomrate is computed according to the algorithm such as the following:
(1) The current scale = min (scale_1, scale_2).
(2) largerinitrate = max (min (scale_1, scale_2), Min (Scale_3, scale_4));
(3) Assuming largerinitrate > scale_limit, then largerinitrate = Scale_limit;
(4) zoomrate = min (scale_2, largerinitrate * 2.0f);
(5) Suppose zoomrate > Scale_limit. Then zoomrate = Scale_limit;
(6) Assuming scale >= zoomrate, the results of the first 3 steps are retained, and the Zoomrate value is computed again from step (4), otherwise jumps to (8)
Zoomrate = Largerinitrate * 2.0f;
(7) Assuming zoomrate > scale_limit, then zoomrate = Scale_limit;
(8) The Zoomrate value is the multiple of the image that should be enlarged.
Android Image double-click algorithm for magnification