Re: [Gimp-developer] Alternative zoom algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simon Budig (Simon.Budig@xxxxxxxxxxx) wrote:
> With this approach it is trivial to implement different approaches
> for the zooming strategy: "homogenous zooming" would multiply/divide
> by sqrt(2), "preset zooming" would have a lookup table with percentages
> for the different zoom steps and move back/forward [1] in it (this also
> easily adresses the "nice looking zoom levels" problem, simply select
> the percentages so that they result in the desired fractions). The user
> then could e.g. select the strategy in the preferences.

To explain what I mean by "homogenous zooming":

when viewing an image at 100% zoom in would result in

100% * sqrt(2)   = 141%
100% * sqrt(2)^2 = 200%
100% * sqrt(2)^3 = 283%
100% * sqrt(2)^4 = 400%
etc.

Zoom out would result in

100% / sqrt(2)   = 71%
100% / sqrt(2)^2 = 50%
100% / sqrt(2)^3 = 35%
100% / sqrt(2)^4 = 25%
etc.

This has the advantage that the behaviour is exactly predictable in
every zoom level, since always exactly the same rectangle of the
viewable area gets magnified. This also would work for other starting
zoom levels.

It seems that some people are scared away by the "weird" percentage
numbers (huh? 283%?) and seem to prefer nice ratios instead.

Ok, this makes things a bit more complicated. I tried to figure out a
set of ratios that tries to emulate the behaviour described above
while using more or less "nice" fractions. These presets could be used
for "preset zooming", i.e. zoom in/out would jump to the next
bigger/smaller preset. Of course this is not as predictable, since you
have to know your current zoom level to know in advance what area will
be magnified. This table tries to minimize this effect.

  sqrt(2)-      percentage  used
   based         preset     ratio

    0.39  ->      0.39 =   1:255
    0.55  ->      0.56 =   1:180
    0.78  ->      0.78 =   1:128
    1.10  ->      1.11 =   1:90 
    1.56  ->      1.56 =   1:64 
    2.21  ->      2.22 =   1:45 
    3.12  ->      3.12 =   1:32 
    4.42  ->      4.44 =   2:45 
    6.25  ->      6.25 =   1:16 
    8.84  ->      9.09 =   1:11 
   12.50  ->     12.50 =   1:8  
   17.68  ->     16.67 =   1:6  
   25.00  ->     25.00 =   1:4  
   35.36  ->     33.33 =   1:3  
   50.00  ->     50.00 =   1:2  
   70.71  ->     66.67 =   2:3  

  100.00  ->    100.00 =   1:1  

  141.42  ->    150.00 =   3:2  
  200.00  ->    200.00 =   2:1  
  282.84  ->    300.00 =   3:1  
  400.00  ->    400.00 =   4:1  
  565.69  ->    600.00 =   6:1  
  800.00  ->    800.00 =   8:1  
 1131.37  ->   1100.00 =  11:1  
 1600.00  ->   1600.00 =  16:1  
 2262.74  ->   2250.00 =  45:2  
 3200.00  ->   3200.00 =  32:1  
 4525.48  ->   4500.00 =  45:1  
 6400.00  ->   6400.00 =  64:1  
 9050.97  ->   9000.00 =  90:1  
12800.00  ->  12800.00 = 128:1  
18101.93  ->  18000.00 = 180:1  
25600.00  ->  25500.00 = 255:1  


Of course it always is possible to choose other zoom levels
interactively with the lens tool etc. This leaves the question what
should happen when the user zooms in/out from an arbitrary zoom level.
IMHO Zoom in/out always should result in a zoom level from the list
above. But - as briefly mentioned in an earlier mail - it would not make
very much sense to jump from 102 % to 100% when the user wants to zoom
out.

I'd suggest to guarantee a minimum zoom out, e.g. by a factor of 0.9.

Examples:

(Zoom out)
102 % * 0.9 = 91.8 % ---> next smaller zoom preset is 66.67 % so we
pick this one.

2 % * 0.9 = 1.8% --> next smaller zoom preset is 1.56%

(Zoom in)
1500 % / 0.9 = 1666.66 % ---> next bigger zoom preset is 2250.00 %

I hope you get the idea.

Ideas? Suggestions? (But please do not complain about the lack of your
favourite zoom level, trying to insert specific "missing" zoom levels in
the table above would completely break the advantages of nearly
homogenous zooming...)

Bye,
        Simon
-- 
      Simon.Budig@xxxxxxxxxxx       http://www.home.unix-ag.org/simon/

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux