Exemplo n.º 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));
        }
Exemplo n.º 2
0
 public static Image GetThumbnail(this Image i, SizeL maxSize)
 {
     return(GetThumbnail(i, maxSize.ToSize()));
 }
Exemplo n.º 3
0
 public static Size GetProportionateResize(this SizeL i, SizeL maxSize)
 {
     return(i.GetProportionateResize(maxSize.ToSize()));
 }
Exemplo n.º 4
0
 public SizeL(SizeL otherSize)
 {
     Width  = otherSize.Width;
     Height = otherSize.Height;
 }