mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
Add GUI configuration for cut out tool
This commit is contained in:
parent
8ca64af596
commit
b784ebe0c7
|
@ -284,6 +284,24 @@ internal class Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Cut cut effect size.
|
||||||
|
/// </summary>
|
||||||
|
internal static string CutOutEffectSize {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CutOutEffectSize", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Cut out effect.
|
||||||
|
/// </summary>
|
||||||
|
internal static string CutOutEffectType {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CutOutEffectType", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -805,4 +805,10 @@ X: {4} Y: {5}</value>
|
||||||
<value>CRF:</value>
|
<value>CRF:</value>
|
||||||
<comment>@Invariant</comment>
|
<comment>@Invariant</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CutOutEffectSize" xml:space="preserve">
|
||||||
|
<value>Cut cut effect size</value>
|
||||||
|
</data>
|
||||||
|
<data name="CutOutEffectType" xml:space="preserve">
|
||||||
|
<value>Cut out effect</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -106,5 +106,9 @@ public class AnnotationOptions
|
||||||
|
|
||||||
// Highlight effect
|
// Highlight effect
|
||||||
public Color HighlightColor { get; set; } = Color.Yellow;
|
public Color HighlightColor { get; set; } = Color.Yellow;
|
||||||
|
|
||||||
|
// Cut Out tool
|
||||||
|
public CutOutEffectType CutOutEffectType { get; set; } = CutOutEffectType.None;
|
||||||
|
public int CutOutEffectSize { get; set; } = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1929,12 +1929,12 @@ public void CutOut(RectangleF rect)
|
||||||
if (isHorizontal && cropRect.Width > 0)
|
if (isHorizontal && cropRect.Width > 0)
|
||||||
{
|
{
|
||||||
CollapseAllHorizontal(rect.X, rect.Width);
|
CollapseAllHorizontal(rect.X, rect.Width);
|
||||||
UpdateCanvas(ImageHelpers.CutOutBitmapMiddle(Form.Canvas, Orientation.Horizontal, cropRect.X, cropRect.Width, CutOutEffectType.ZigZag, 5));
|
UpdateCanvas(ImageHelpers.CutOutBitmapMiddle(Form.Canvas, Orientation.Horizontal, cropRect.X, cropRect.Width, AnnotationOptions.CutOutEffectType, AnnotationOptions.CutOutEffectSize));
|
||||||
}
|
}
|
||||||
else if (!isHorizontal && cropRect.Height > 0)
|
else if (!isHorizontal && cropRect.Height > 0)
|
||||||
{
|
{
|
||||||
CollapseAllVertical(rect.Y, rect.Height);
|
CollapseAllVertical(rect.Y, rect.Height);
|
||||||
UpdateCanvas(ImageHelpers.CutOutBitmapMiddle(Form.Canvas, Orientation.Vertical, cropRect.Y, cropRect.Height, CutOutEffectType.ZigZag, 5));
|
UpdateCanvas(ImageHelpers.CutOutBitmapMiddle(Form.Canvas, Orientation.Vertical, cropRect.Y, cropRect.Height, AnnotationOptions.CutOutEffectType, AnnotationOptions.CutOutEffectSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ internal partial class ShapeManager
|
||||||
private ToolStripMenuItem tsmiShadow, tsmiShadowColor, tsmiUndo, tsmiDuplicate, tsmiDelete, tsmiDeleteAll,
|
private ToolStripMenuItem tsmiShadow, tsmiShadowColor, tsmiUndo, tsmiDuplicate, tsmiDelete, tsmiDeleteAll,
|
||||||
tsmiMoveTop, tsmiMoveUp, tsmiMoveDown, tsmiMoveBottom, tsmiRegionCapture, tsmiQuickCrop, tsmiShowMagnifier;
|
tsmiMoveTop, tsmiMoveUp, tsmiMoveDown, tsmiMoveBottom, tsmiRegionCapture, tsmiQuickCrop, tsmiShowMagnifier;
|
||||||
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudCenterPoints, tslnudBlurRadius, tslnudPixelateSize, tslnudStepFontSize,
|
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudCenterPoints, tslnudBlurRadius, tslnudPixelateSize, tslnudStepFontSize,
|
||||||
tslnudMagnifierPixelCount, tslnudStartingStepValue, tslnudMagnifyStrength;
|
tslnudMagnifierPixelCount, tslnudStartingStepValue, tslnudMagnifyStrength, tslnudCutOutEffectSize;
|
||||||
private ToolStripLabel tslDragLeft, tslDragRight;
|
private ToolStripLabel tslDragLeft, tslDragRight;
|
||||||
private ToolStripLabeledComboBox tscbBorderStyle, tscbArrowHeadDirection, tscbImageInterpolationMode, tscbCursorTypes, tscbStepType;
|
private ToolStripLabeledComboBox tscbBorderStyle, tscbArrowHeadDirection, tscbImageInterpolationMode, tscbCursorTypes, tscbStepType, tscbCutOutEffectType;
|
||||||
|
|
||||||
internal void CreateToolbar()
|
internal void CreateToolbar()
|
||||||
{
|
{
|
||||||
|
@ -642,6 +642,26 @@ internal void CreateToolbar()
|
||||||
};
|
};
|
||||||
tsddbShapeOptions.DropDownItems.Add(tsmiShadowColor);
|
tsddbShapeOptions.DropDownItems.Add(tsmiShadowColor);
|
||||||
|
|
||||||
|
tscbCutOutEffectType = new ToolStripLabeledComboBox(Resources.CutOutEffectType);
|
||||||
|
tscbCutOutEffectType.Content.AddRange(Helpers.GetLocalizedEnumDescriptions<CutOutEffectType>());
|
||||||
|
tscbCutOutEffectType.Content.SelectedIndexChanged += (sender, e) =>
|
||||||
|
{
|
||||||
|
AnnotationOptions.CutOutEffectType = (CutOutEffectType)tscbCutOutEffectType.Content.SelectedIndex;
|
||||||
|
tscbCutOutEffectType.Invalidate();
|
||||||
|
UpdateCurrentShape();
|
||||||
|
};
|
||||||
|
tsddbShapeOptions.DropDownItems.Add(tscbCutOutEffectType);
|
||||||
|
|
||||||
|
tslnudCutOutEffectSize = new ToolStripLabeledNumericUpDown(Resources.CutOutEffectSize);
|
||||||
|
tslnudCutOutEffectSize.Content.Minimum = 3;
|
||||||
|
tslnudCutOutEffectSize.Content.Maximum = 100;
|
||||||
|
tslnudCutOutEffectSize.Content.ValueChanged = (sender, e) =>
|
||||||
|
{
|
||||||
|
AnnotationOptions.CutOutEffectSize = (int)tslnudCutOutEffectSize.Content.Value;
|
||||||
|
UpdateCurrentShape();
|
||||||
|
};
|
||||||
|
tsddbShapeOptions.DropDownItems.Add(tslnudCutOutEffectSize);
|
||||||
|
|
||||||
// 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...
|
// 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 });
|
tsddbShapeOptions.DropDownItems.Add(new ToolStripSeparator() { Visible = false });
|
||||||
|
|
||||||
|
@ -1456,6 +1476,10 @@ private void UpdateMenu()
|
||||||
|
|
||||||
tscbArrowHeadDirection.Content.SelectedIndex = (int)AnnotationOptions.ArrowHeadDirection;
|
tscbArrowHeadDirection.Content.SelectedIndex = (int)AnnotationOptions.ArrowHeadDirection;
|
||||||
|
|
||||||
|
tscbCutOutEffectType.Content.SelectedIndex = (int)AnnotationOptions.CutOutEffectType;
|
||||||
|
|
||||||
|
tslnudCutOutEffectSize.Content.Value = AnnotationOptions.CutOutEffectSize;
|
||||||
|
|
||||||
switch (shapeType)
|
switch (shapeType)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -1477,6 +1501,7 @@ private void UpdateMenu()
|
||||||
case ShapeType.DrawingCursor:
|
case ShapeType.DrawingCursor:
|
||||||
case ShapeType.EffectBlur:
|
case ShapeType.EffectBlur:
|
||||||
case ShapeType.EffectPixelate:
|
case ShapeType.EffectPixelate:
|
||||||
|
case ShapeType.ToolCutOut:
|
||||||
tsddbShapeOptions.Visible = true;
|
tsddbShapeOptions.Visible = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1561,6 +1586,8 @@ private void UpdateMenu()
|
||||||
tslnudBlurRadius.Visible = shapeType == ShapeType.EffectBlur;
|
tslnudBlurRadius.Visible = shapeType == ShapeType.EffectBlur;
|
||||||
tslnudPixelateSize.Visible = shapeType == ShapeType.EffectPixelate;
|
tslnudPixelateSize.Visible = shapeType == ShapeType.EffectPixelate;
|
||||||
tsbHighlightColor.Visible = shapeType == ShapeType.EffectHighlight;
|
tsbHighlightColor.Visible = shapeType == ShapeType.EffectHighlight;
|
||||||
|
tscbCutOutEffectType.Visible = shapeType == ShapeType.ToolCutOut;
|
||||||
|
tslnudCutOutEffectSize.Visible = shapeType == ShapeType.ToolCutOut;
|
||||||
|
|
||||||
if (tsmiRegionCapture != null)
|
if (tsmiRegionCapture != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue