From 6408f07cb1c5b755fde0e58ea8b2daa3ea64ffb7 Mon Sep 17 00:00:00 2001 From: James South Date: Thu, 13 Feb 2014 10:53:00 +0000 Subject: [PATCH] Rounded corners was calculating values at half. Former-commit-id: ca59f6fd8200e243bc58504b04eae2d8272c6f48 --- src/ImageProcessor/Processors/RoundedCorners.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ImageProcessor/Processors/RoundedCorners.cs b/src/ImageProcessor/Processors/RoundedCorners.cs index ee6b0008b..c8067c4fa 100644 --- a/src/ImageProcessor/Processors/RoundedCorners.cs +++ b/src/ImageProcessor/Processors/RoundedCorners.cs @@ -207,6 +207,7 @@ namespace ImageProcessor.Processors { int width = image.Width; int height = image.Height; + int cornerDiameter = cornerRadius * 2; // Create a new empty bitmap to hold rotated image Bitmap newImage = new Bitmap(image.Width, image.Height); @@ -232,7 +233,7 @@ namespace ImageProcessor.Processors // Determined if the top left has a rounded corner if (topLeft) { - path.AddArc(0, 0, cornerRadius, cornerRadius, 180, 90); + path.AddArc(0, 0, cornerDiameter, cornerDiameter, 180, 90); } else { @@ -242,7 +243,7 @@ namespace ImageProcessor.Processors // Determined if the top right has a rounded corner if (topRight) { - path.AddArc(0 + width - cornerRadius, 0, cornerRadius, cornerRadius, 270, 90); + path.AddArc(0 + width - cornerDiameter, 0, cornerDiameter, cornerDiameter, 270, 90); } else { @@ -252,7 +253,7 @@ namespace ImageProcessor.Processors // Determined if the bottom left has a rounded corner if (bottomRight) { - path.AddArc(0 + width - cornerRadius, 0 + height - cornerRadius, cornerRadius, cornerRadius, 0, 90); + path.AddArc(0 + width - cornerDiameter, 0 + height - cornerDiameter, cornerDiameter, cornerDiameter, 0, 90); } else { @@ -262,7 +263,7 @@ namespace ImageProcessor.Processors // Determined if the bottom right has a rounded corner if (bottomLeft) { - path.AddArc(0, 0 + height - cornerRadius, cornerRadius, cornerRadius, 90, 90); + path.AddArc(0, 0 + height - cornerDiameter, cornerDiameter, cornerDiameter, 90, 90); } else {