[Gimp-developer] Re: Alternative zoom algorithm

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

 



This is my first post here.  Is the proper protocol to
1) post here to the mail lists?
2) put on the bug list?
3) both?
 

In reference to the earlier discussion about uniform
zooming scale factors, why not let the user choose his
own (reasonable) scale factor in preferences?  It
could be set to sqrt(2) by default.  The code
below rounds to the nearest multiple of the factor.  I
think it is an elegant solution which gives a lot of
power to the user.
 
gdouble
gimp_display_shell_scale_zoom_step (GimpZoomType
zoom_type,
                                    gdouble     
scale,
         gdouble      factor)
{
  /* scale is scaled by factor which is nominally =
sqrt(2) */
  /* the user enters factor in preferences */
  /* need enough significant digits in factor to get
"nice" scales */
  /* e.g. factor = sqrt(2) = 1.414213562373 */
  switch (zoom_type)
    {
    case GIMP_ZOOM_IN:
      factor = CLAMP (factor, 1.1, 4.0);
      scale = CLAMP (scale, 1.0/256.0, 256.0);
      scale =
pow(factor,floor(log(scale)/log(factor)+0.5)-1.0);
      break;
    case GIMP_ZOOM_OUT:
      factor = CLAMP (factor, 1.1, 4.0);
      scale = CLAMP (scale, 1.0/256.0, 256.0);
      scale =
pow(factor,floor(log(scale)/log(factor)+0.5)+1.0);
      break;
    case GIMP_ZOOM_TO:
      break;
    }
  return CLAMP (scale, 1.0/256.0, 256.0);
}
 
Regards,
Harold
 
 



__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

[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