Cleanup / PR feedback

This commit is contained in:
Michael Bray 2024-04-12 17:12:31 -04:00
parent fc4cead407
commit 4012835064
5 changed files with 19 additions and 12 deletions

View File

@ -1934,7 +1934,10 @@ namespace ShareX.HelpersLib
{
g.SetHighQuality();
g.PixelOffsetMode = PixelOffsetMode.Half;
g.Clear(cutOutBackgroundColor);
if (cutOutBackgroundColor.A > 0)
{
g.Clear(cutOutBackgroundColor);
}
g.FillPolygon(brush, points.ToArray());
}
return bmpResult;
@ -2029,7 +2032,10 @@ namespace ShareX.HelpersLib
{
g.SetHighQuality();
g.PixelOffsetMode = PixelOffsetMode.Half;
g.Clear(cutOutBackgroundColor);
if (cutOutBackgroundColor.A > 0)
{
g.Clear(cutOutBackgroundColor);
}
Point[] fillPoints = points.Distinct().ToArray();

View File

@ -56,7 +56,7 @@ namespace ShareX.ImageEffectsLib
public override Bitmap Apply(Bitmap bmp)
{
return ImageHelpers.TornEdges(bmp, Depth, Range, Sides, CurvedEdges, true, this.CutOutBackgroundColor);
return ImageHelpers.TornEdges(bmp, Depth, Range, Sides, CurvedEdges, true, CutOutBackgroundColor);
}
protected override string GetSummary()

View File

@ -53,7 +53,7 @@ namespace ShareX.ImageEffectsLib
public override Bitmap Apply(Bitmap bmp)
{
return ImageHelpers.WavyEdges(bmp, Depth, Range, Sides, this.CutOutBackgroundColor);
return ImageHelpers.WavyEdges(bmp, Depth, Range, Sides, CutOutBackgroundColor);
}
protected override string GetSummary()

View File

@ -47,7 +47,6 @@ namespace ShareX.ScreenCaptureLib
public int DrawingCornerRadius { get; set; } = 3;
public bool Shadow { get; set; } = true;
public Color ShadowColor { get; set; } = Color.FromArgb(125, 0, 0, 0);
public Color CutOutBackgroundColor { get; set; } = Color.Transparent;
public Point ShadowOffset { get; set; } = new Point(0, 1);
// Line, arrow drawing
@ -111,5 +110,6 @@ namespace ShareX.ScreenCaptureLib
// Cut out tool
public CutOutEffectType CutOutEffectType { get; set; } = CutOutEffectType.None;
public int CutOutEffectSize { get; set; } = 10;
public Color CutOutBackgroundColor { get; set; } = Color.Transparent;
}
}

View File

@ -49,7 +49,7 @@ namespace ShareX.ScreenCaptureLib
private ToolStripButton tsbSaveImage, tsbBorderColor, tsbFillColor, tsbHighlightColor;
private ToolStripDropDownButton tsddbShapeOptions;
private ToolStripMenuItem tsmiShadow, tsmiShadowColor, tsmiUndo, tsmiRedo, tsmiDuplicate, tsmiDelete, tsmiDeleteAll,
tsmiMoveTop, tsmiMoveUp, tsmiMoveDown, tsmiMoveBottom, tsmiRegionCapture, tsmiQuickCrop, tsmiShowMagnifier, tsmiCutoutBackgroundColor;
tsmiMoveTop, tsmiMoveUp, tsmiMoveDown, tsmiMoveBottom, tsmiRegionCapture, tsmiQuickCrop, tsmiShowMagnifier, tsmiCutOutBackgroundColor;
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudCenterPoints, tslnudBlurRadius, tslnudPixelateSize, tslnudStepFontSize,
tslnudMagnifierPixelCount, tslnudStartingStepValue, tslnudMagnifyStrength, tslnudCutOutEffectSize;
private ToolStripLabel tslDragLeft, tslDragRight;
@ -668,8 +668,8 @@ namespace ShareX.ScreenCaptureLib
};
tsddbShapeOptions.DropDownItems.Add(tslnudCutOutEffectSize);
tsmiCutoutBackgroundColor = new ToolStripMenuItem(Resources.CutOutBackgroundColor);
tsmiCutoutBackgroundColor.Click += (sender, e) =>
tsmiCutOutBackgroundColor = new ToolStripMenuItem(Resources.CutOutBackgroundColor);
tsmiCutOutBackgroundColor.Click += (sender, e) =>
{
Form.Pause();
@ -682,7 +682,7 @@ namespace ShareX.ScreenCaptureLib
Form.Resume();
};
tsddbShapeOptions.DropDownItems.Add(tsmiCutoutBackgroundColor);
tsddbShapeOptions.DropDownItems.Add(tsmiCutOutBackgroundColor);
// In dropdown menu if only last item is visible then menu opens at 0, 0 position on first open, so need to add dummy item to solve this weird bug...
tsddbShapeOptions.DropDownItems.Add(new ToolStripSeparator() { Visible = false });
@ -1508,8 +1508,8 @@ namespace ShareX.ScreenCaptureLib
tslnudCutOutEffectSize.Content.Value = AnnotationOptions.CutOutEffectSize;
if (tsmiCutoutBackgroundColor.Image != null) tsmiCutoutBackgroundColor.Image.Dispose();
tsmiCutoutBackgroundColor.Image = ImageHelpers.CreateColorPickerIcon(AnnotationOptions.CutOutBackgroundColor, new Rectangle(0, 0, 16, 16));
if (tsmiCutOutBackgroundColor.Image != null) tsmiCutOutBackgroundColor.Image.Dispose();
tsmiCutOutBackgroundColor.Image = ImageHelpers.CreateColorPickerIcon(AnnotationOptions.CutOutBackgroundColor, new Rectangle(0, 0, 16, 16));
switch (shapeType)
{
@ -1565,6 +1565,7 @@ namespace ShareX.ScreenCaptureLib
tsbBorderColor.Visible = true;
tslnudBorderSize.Visible = true;
tsmiShadow.Visible = true;
tsmiShadowColor.Visible = true;
break;
}
@ -1623,7 +1624,7 @@ namespace ShareX.ScreenCaptureLib
tsbHighlightColor.Visible = shapeType == ShapeType.EffectHighlight;
tscbCutOutEffectType.Visible = shapeType == ShapeType.ToolCutOut;
tslnudCutOutEffectSize.Visible = shapeType == ShapeType.ToolCutOut;
tsmiCutoutBackgroundColor.Visible = shapeType == ShapeType.ToolCutOut;
tsmiCutOutBackgroundColor.Visible = shapeType == ShapeType.ToolCutOut;
if (tsmiRegionCapture != null)
{