| | |
| | | /// <param name="img"></param> |
| | | /// <param name="format">默认Format32bppArgb</param> |
| | | /// <returns></returns> |
| | | public static Image CloneC(this Image img, PixelFormat format = PixelFormat.Format32bppArgb) |
| | | public static Bitmap CloneC(this Image img, PixelFormat format = PixelFormat.Format32bppArgb) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | catch |
| | | { |
| | | return img; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自定义创建图片的副本(若PixelFormat为索引像素格式会抛异常)) |
| | | /// </summary> |
| | | public static Image CloneC(this Image img, float width, float height, PixelFormat format = PixelFormat.Format32bppArgb) |
| | | public static Bitmap CloneC(this Image img, float width, float height, PixelFormat format = PixelFormat.Format32bppArgb) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | catch |
| | | { |
| | | return img; |
| | | return null; |
| | | } |
| | | } |
| | | |