summaryrefslogtreecommitdiff
path: root/ImageHelper.cs
diff options
context:
space:
mode:
authorRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
committerRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
commitf6f3bbbc5b7741ad0db3c88a398cfc3943988529 (patch)
treef9f3aca3cc688369607060336b699b8f711eb360 /ImageHelper.cs
parent5a045404f3c49022abeb75c27dfe6f82d35928f7 (diff)
Diffstat (limited to 'ImageHelper.cs')
-rw-r--r--ImageHelper.cs78
1 files changed, 39 insertions, 39 deletions
diff --git a/ImageHelper.cs b/ImageHelper.cs
index 3ad91a6..fbfd501 100644
--- a/ImageHelper.cs
+++ b/ImageHelper.cs
@@ -1,39 +1,39 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Chess
-{
- public class ImageHelper
- {
- public static Bitmap ResizeImage(Image image, int width, int height)
- {
- var destRect = new Rectangle(0, 0, width, height);
- var destImage = new Bitmap(width, height);
-
- destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
-
- using (var graphics = Graphics.FromImage(destImage))
- {
- graphics.CompositingMode = CompositingMode.SourceCopy;
- graphics.CompositingQuality = CompositingQuality.HighQuality;
- graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
- graphics.SmoothingMode = SmoothingMode.HighQuality;
- graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
-
- using (var wrapMode = new ImageAttributes())
- {
- wrapMode.SetWrapMode(WrapMode.TileFlipXY);
- graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
- }
- }
-
- return destImage;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Chess
+{
+ public class ImageHelper
+ {
+ public static Bitmap ResizeImage(Image image, int width, int height)
+ {
+ var destRect = new Rectangle(0, 0, width, height);
+ var destImage = new Bitmap(width, height);
+
+ destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
+
+ using (var graphics = Graphics.FromImage(destImage))
+ {
+ graphics.CompositingMode = CompositingMode.SourceCopy;
+ graphics.CompositingQuality = CompositingQuality.HighQuality;
+ graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ graphics.SmoothingMode = SmoothingMode.HighQuality;
+ graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
+
+ using (var wrapMode = new ImageAttributes())
+ {
+ wrapMode.SetWrapMode(WrapMode.TileFlipXY);
+ graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
+ }
+ }
+
+ return destImage;
+ }
+ }
+}