Example #1
0
        public static Size GetProportionateResize(this SizeL i, Size maxSize)
        {
            var ratioX = (double)maxSize.Width / i.Width;
            var ratioY = (double)maxSize.Height / i.Height;
            var ratio  = Math.Min(ratioX, ratioY);

            var newWidth  = (int)Math.Ceiling(i.Width * ratio);
            var newHeight = (int)(i.Height * ratio);

            return(new Size(newWidth, newHeight));
        }
Example #2
0
 public static Image GetThumbnail(this Image i, SizeL maxSize)
 {
     return(GetThumbnail(i, maxSize.ToSize()));
 }
Example #3
0
 public static Size GetProportionateResize(this SizeL i, SizeL maxSize)
 {
     return(i.GetProportionateResize(maxSize.ToSize()));
 }
Example #4
0
 public SizeL(SizeL otherSize)
 {
     Width  = otherSize.Width;
     Height = otherSize.Height;
 }