Rename TrimInteriorTool to CutOutTool

This commit is contained in:
Niels Martin Hansen 2022-08-16 12:11:13 +02:00
parent b1f7441176
commit d5f522ab80
5 changed files with 12 additions and 12 deletions

View file

@ -223,7 +223,7 @@ public static Bitmap CropBitmap(Bitmap bmp, Rectangle rect)
return null; return null;
} }
public static Bitmap TrimBitmapInteriorHorizontal(Bitmap bmp, int x, int width) public static Bitmap CutOutBitmapMiddleHorizontal(Bitmap bmp, int x, int width)
{ {
if (bmp != null && width > 0) if (bmp != null && width > 0)
{ {
@ -255,7 +255,7 @@ public static Bitmap TrimBitmapInteriorHorizontal(Bitmap bmp, int x, int width)
return null; return null;
} }
public static Bitmap TrimBitmapInteriorVertical(Bitmap bmp, int y, int height) public static Bitmap CutOutBitmapMiddleVertical(Bitmap bmp, int y, int height)
{ {
if (bmp != null && height > 0) if (bmp != null && height > 0)
{ {

View file

@ -292,7 +292,7 @@ public enum ShapeType // Localized
EffectPixelate, EffectPixelate,
EffectHighlight, EffectHighlight,
ToolCrop, ToolCrop,
ToolTrimInterior ToolCutOut
} }
public enum ScrollingCaptureScrollMethod // Localized public enum ScrollingCaptureScrollMethod // Localized

View file

@ -1195,8 +1195,8 @@ private BaseShape CreateShape(ShapeType shapeType)
case ShapeType.ToolCrop: case ShapeType.ToolCrop:
shape = new CropTool(); shape = new CropTool();
break; break;
case ShapeType.ToolTrimInterior: case ShapeType.ToolCutOut:
shape = new TrimInteriorTool(); shape = new CutOutTool();
break; break;
} }
@ -1820,7 +1820,7 @@ public Bitmap CropImage(RectangleF rect, bool onlyIfSizeDifferent = false)
return null; return null;
} }
public void TrimInterior(RectangleF rect) public void CutOut(RectangleF rect)
{ {
bool isHorizontal = rect.Width > rect.Height; bool isHorizontal = rect.Width > rect.Height;
@ -1833,12 +1833,12 @@ public void TrimInterior(RectangleF rect)
if (isHorizontal && cropRect.Width > 0) if (isHorizontal && cropRect.Width > 0)
{ {
CollapseAllHorizontal(rect.X, rect.Width); CollapseAllHorizontal(rect.X, rect.Width);
UpdateCanvas(ImageHelpers.TrimBitmapInteriorHorizontal(Form.Canvas, cropRect.X, cropRect.Width)); UpdateCanvas(ImageHelpers.CutOutBitmapMiddleHorizontal(Form.Canvas, cropRect.X, cropRect.Width));
} }
else if (!isHorizontal && cropRect.Height > 0) else if (!isHorizontal && cropRect.Height > 0)
{ {
CollapseAllVertical(rect.Y, rect.Height); CollapseAllVertical(rect.Y, rect.Height);
UpdateCanvas(ImageHelpers.TrimBitmapInteriorVertical(Form.Canvas, cropRect.Y, cropRect.Height)); UpdateCanvas(ImageHelpers.CutOutBitmapMiddleVertical(Form.Canvas, cropRect.Y, cropRect.Height));
} }
} }

View file

@ -29,9 +29,9 @@
namespace ShareX.ScreenCaptureLib namespace ShareX.ScreenCaptureLib
{ {
public class TrimInteriorTool : BaseTool public class CutOutTool : BaseTool
{ {
public override ShapeType ShapeType { get; } = ShapeType.ToolTrimInterior; public override ShapeType ShapeType { get; } = ShapeType.ToolCutOut;
public override bool LimitRectangleToInsideCanvas { get; } = true; public override bool LimitRectangleToInsideCanvas { get; } = true;
@ -112,7 +112,7 @@ public override void OnCreated()
private void ConfirmButton_MousePressed(object sender, MouseEventArgs e) private void ConfirmButton_MousePressed(object sender, MouseEventArgs e)
{ {
Manager.TrimInterior(Rectangle); Manager.CutOut(Rectangle);
Remove(); Remove();
} }

View file

@ -226,7 +226,7 @@
<Compile Include="Animations\TextAnimation.cs" /> <Compile Include="Animations\TextAnimation.cs" />
<Compile Include="RegionHelpers\WindowsList.cs" /> <Compile Include="RegionHelpers\WindowsList.cs" />
<Compile Include="RegionHelpers\WindowsRectangleList.cs" /> <Compile Include="RegionHelpers\WindowsRectangleList.cs" />
<Compile Include="Shapes\Tool\TrimInteriorTool.cs" /> <Compile Include="Shapes\Tool\CutOutTool.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ShareX.HelpersLib\ShareX.HelpersLib.csproj"> <ProjectReference Include="..\ShareX.HelpersLib\ShareX.HelpersLib.csproj">