예제 #1
0
 public static Image Resize(this Image imgSource, ImageResizeType type, int width, int height)
 {
     if (type == ImageResizeType.Scale)
     {
         return(ImageResizer.GetResizedImage(imgSource, width, height));
     }
     if (type == ImageResizeType.Croped)
     {
         return(ImageResizer.GetCropedImage(imgSource, width, height));
     }
     return(null);
 }
예제 #2
0
 private static ResizerBase GetResizer(Image img, ImageResizeType type)
 {
     switch (type)
     {
         case ImageResizeType.Crop: return new CropResizer(img);
         case ImageResizeType.BestSize:return new BestSizeResizer(img);
         case ImageResizeType.Default: return new DefaultResizer(img);
     }
     throw new ArgumentOutOfRangeException("type");
 }