diff --git a/ShareX.HelpersLib/Enums.cs b/ShareX.HelpersLib/Enums.cs index 59fe208ab..6ef449cdd 100644 --- a/ShareX.HelpersLib/Enums.cs +++ b/ShareX.HelpersLib/Enums.cs @@ -212,4 +212,13 @@ public enum StepType // Localized RomanNumeralsUppercase, RomanNumeralsLowercase } + + public enum CutOutEffectType // Localized (probably) + { + None, + ZigZag, + TornEdge, + Wave, + Gradient + } } \ No newline at end of file diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index f82fc256d..6a2b78798 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -223,7 +223,7 @@ public static Bitmap CropBitmap(Bitmap bmp, Rectangle rect) return null; } - public static Bitmap CutOutBitmapMiddleHorizontal(Bitmap bmp, int x, int width) + public static Bitmap CutOutBitmapMiddleHorizontal(Bitmap bmp, int x, int width, CutOutEffectType effectType, int effectSize) { if (bmp != null && width > 0) { @@ -231,11 +231,39 @@ public static Bitmap CutOutBitmapMiddleHorizontal(Bitmap bmp, int x, int width) if (x > 0) { leftPart = CropBitmap(bmp, new Rectangle(0, 0, Math.Min(x, bmp.Width), bmp.Height)); + switch (effectType) + { + case CutOutEffectType.None: + break; + case CutOutEffectType.ZigZag: + break; + case CutOutEffectType.TornEdge: + leftPart = TornEdges(leftPart, effectSize, effectSize * 2, AnchorStyles.Right, false); + break; + case CutOutEffectType.Wave: + break; + case CutOutEffectType.Gradient: + break; + } } if (x + width < bmp.Width) { int x2 = Math.Max(x + width, 0); rightPart = CropBitmap(bmp, new Rectangle(x2, 0, bmp.Width - x2, bmp.Height)); + switch (effectType) + { + case CutOutEffectType.None: + break; + case CutOutEffectType.ZigZag: + break; + case CutOutEffectType.TornEdge: + rightPart = TornEdges(rightPart, effectSize, effectSize * 2, AnchorStyles.Left, false); + break; + case CutOutEffectType.Wave: + break; + case CutOutEffectType.Gradient: + break; + } } if (leftPart != null && rightPart != null) @@ -255,7 +283,7 @@ public static Bitmap CutOutBitmapMiddleHorizontal(Bitmap bmp, int x, int width) return null; } - public static Bitmap CutOutBitmapMiddleVertical(Bitmap bmp, int y, int height) + public static Bitmap CutOutBitmapMiddleVertical(Bitmap bmp, int y, int height, CutOutEffectType effectType, int effectSize) { if (bmp != null && height > 0) { @@ -263,11 +291,39 @@ public static Bitmap CutOutBitmapMiddleVertical(Bitmap bmp, int y, int height) if (y > 0) { topPart = CropBitmap(bmp, new Rectangle(0, 0, bmp.Width, Math.Min(y, bmp.Height))); + switch (effectType) + { + case CutOutEffectType.None: + break; + case CutOutEffectType.ZigZag: + break; + case CutOutEffectType.TornEdge: + topPart = TornEdges(topPart, effectSize, effectSize * 2, AnchorStyles.Bottom, false); + break; + case CutOutEffectType.Wave: + break; + case CutOutEffectType.Gradient: + break; + } } if (y + height < bmp.Height) { int y2 = Math.Max(y + height, 0); bottomPart = CropBitmap(bmp, new Rectangle(0, y2, bmp.Width, bmp.Height - y2)); + switch (effectType) + { + case CutOutEffectType.None: + break; + case CutOutEffectType.ZigZag: + break; + case CutOutEffectType.TornEdge: + bottomPart = TornEdges(bottomPart, effectSize, effectSize * 2, AnchorStyles.Top, false); + break; + case CutOutEffectType.Wave: + break; + case CutOutEffectType.Gradient: + break; + } } if (topPart != null && bottomPart != null) diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs index a080e640d..3820579dd 100644 --- a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs +++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs @@ -1931,12 +1931,12 @@ public void CutOut(RectangleF rect) if (isHorizontal && cropRect.Width > 0) { CollapseAllHorizontal(rect.X, rect.Width); - UpdateCanvas(ImageHelpers.CutOutBitmapMiddleHorizontal(Form.Canvas, cropRect.X, cropRect.Width)); + UpdateCanvas(ImageHelpers.CutOutBitmapMiddleHorizontal(Form.Canvas, cropRect.X, cropRect.Width, CutOutEffectType.TornEdge, 5)); } else if (!isHorizontal && cropRect.Height > 0) { CollapseAllVertical(rect.Y, rect.Height); - UpdateCanvas(ImageHelpers.CutOutBitmapMiddleVertical(Form.Canvas, cropRect.Y, cropRect.Height)); + UpdateCanvas(ImageHelpers.CutOutBitmapMiddleVertical(Form.Canvas, cropRect.Y, cropRect.Height, CutOutEffectType.TornEdge, 5)); } }