Added drop shadow option to region capture toolbar

This commit is contained in:
Jaex 2016-11-30 00:11:39 +03:00
parent 9000cf31a7
commit 35335e0d43
5 changed files with 24 additions and 5 deletions

View file

@ -31,8 +31,9 @@ public class AnnotationOptions
{ {
// Drawing // Drawing
public Color BorderColor { get; set; } = Color.Red; public Color BorderColor { get; set; } = Color.Red;
public int BorderSize { get; set; } = 3; public int BorderSize { get; set; } = 5;
public Color FillColor { get; set; } = Color.FromArgb(0, 0, 0, 0); public Color FillColor { get; set; } = Color.FromArgb(0, 0, 0, 0);
public bool Shadow { get; set; } = true;
// Rounded rectangle region, rounded rectangle drawing // Rounded rectangle region, rounded rectangle drawing
public int RoundedRectangleRadius { get; set; } = 8; public int RoundedRectangleRadius { get; set; } = 8;

View file

@ -48,6 +48,7 @@ public override void OnConfigLoad()
BorderColor = AnnotationOptions.BorderColor; BorderColor = AnnotationOptions.BorderColor;
BorderSize = AnnotationOptions.BorderSize; BorderSize = AnnotationOptions.BorderSize;
FillColor = AnnotationOptions.FillColor; FillColor = AnnotationOptions.FillColor;
Shadow = AnnotationOptions.Shadow;
} }
public override void OnConfigSave() public override void OnConfigSave()
@ -55,6 +56,7 @@ public override void OnConfigSave()
AnnotationOptions.BorderColor = BorderColor; AnnotationOptions.BorderColor = BorderColor;
AnnotationOptions.BorderSize = BorderSize; AnnotationOptions.BorderSize = BorderSize;
AnnotationOptions.FillColor = FillColor; AnnotationOptions.FillColor = FillColor;
AnnotationOptions.Shadow = Shadow;
} }
public abstract void OnDraw(Graphics g); public abstract void OnDraw(Graphics g);

View file

@ -26,7 +26,6 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib; using ShareX.HelpersLib;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
namespace ShareX.ScreenCaptureLib namespace ShareX.ScreenCaptureLib
@ -60,6 +59,7 @@ public override void OnConfigLoad()
BorderColor = AnnotationOptions.StepBorderColor; BorderColor = AnnotationOptions.StepBorderColor;
BorderSize = AnnotationOptions.StepBorderSize; BorderSize = AnnotationOptions.StepBorderSize;
FillColor = AnnotationOptions.StepFillColor; FillColor = AnnotationOptions.StepFillColor;
Shadow = AnnotationOptions.Shadow;
} }
public override void OnConfigSave() public override void OnConfigSave()
@ -67,6 +67,7 @@ public override void OnConfigSave()
AnnotationOptions.StepBorderColor = BorderColor; AnnotationOptions.StepBorderColor = BorderColor;
AnnotationOptions.StepBorderSize = BorderSize; AnnotationOptions.StepBorderSize = BorderSize;
AnnotationOptions.StepFillColor = FillColor; AnnotationOptions.StepFillColor = FillColor;
AnnotationOptions.Shadow = Shadow;
} }
public override void OnDraw(Graphics g) public override void OnDraw(Graphics g)

View file

@ -43,6 +43,7 @@ public override void OnConfigLoad()
BorderSize = AnnotationOptions.TextBorderSize; BorderSize = AnnotationOptions.TextBorderSize;
FillColor = AnnotationOptions.TextFillColor; FillColor = AnnotationOptions.TextFillColor;
CornerRadius = AnnotationOptions.TextCornerRadius; CornerRadius = AnnotationOptions.TextCornerRadius;
Shadow = AnnotationOptions.Shadow;
} }
public override void OnConfigSave() public override void OnConfigSave()
@ -51,7 +52,8 @@ public override void OnConfigSave()
AnnotationOptions.TextBorderColor = BorderColor; AnnotationOptions.TextBorderColor = BorderColor;
AnnotationOptions.TextBorderSize = BorderSize; AnnotationOptions.TextBorderSize = BorderSize;
AnnotationOptions.TextFillColor = FillColor; AnnotationOptions.TextFillColor = FillColor;
AnnotationOptions.TextCornerRadius = (int)CornerRadius; AnnotationOptions.TextCornerRadius = CornerRadius;
AnnotationOptions.Shadow = Shadow;
} }
public override void OnDraw(Graphics g) public override void OnDraw(Graphics g)

View file

@ -42,7 +42,7 @@ internal partial class ShapeManager
private ToolStripEx tsMain; private ToolStripEx tsMain;
private ToolStripButton tsbBorderColor, tsbFillColor, tsbHighlightColor, tsbUndoObject, tsbDeleteAll; private ToolStripButton tsbBorderColor, tsbFillColor, tsbHighlightColor, tsbUndoObject, tsbDeleteAll;
private ToolStripDropDownButton tsddbShapeOptions; private ToolStripDropDownButton tsddbShapeOptions;
private ToolStripMenuItem tsmiQuickCrop, tsmiRegionCapture; private ToolStripMenuItem tsmiShadow, tsmiQuickCrop, tsmiRegionCapture;
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudBlurRadius, tslnudPixelateSize; private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudBlurRadius, tslnudPixelateSize;
private ToolStripLabel tslDragLeft; private ToolStripLabel tslDragLeft;
@ -373,7 +373,6 @@ private void CreateToolbar()
tsddbShapeOptions = new ToolStripDropDownButton("Shape options"); tsddbShapeOptions = new ToolStripDropDownButton("Shape options");
tsddbShapeOptions.DisplayStyle = ToolStripItemDisplayStyle.Image; tsddbShapeOptions.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsddbShapeOptions.HideImageMargin();
tsddbShapeOptions.Image = Resources.layer__pencil; tsddbShapeOptions.Image = Resources.layer__pencil;
tsMain.Items.Add(tsddbShapeOptions); tsMain.Items.Add(tsddbShapeOptions);
@ -444,6 +443,16 @@ private void CreateToolbar()
}; };
tsddbShapeOptions.DropDownItems.Add(tslnudPixelateSize); tsddbShapeOptions.DropDownItems.Add(tslnudPixelateSize);
tsmiShadow = new ToolStripMenuItem("Drop shadow");
tsmiShadow.Checked = true;
tsmiShadow.CheckOnClick = true;
tsmiShadow.Click += (sender, e) =>
{
AnnotationOptions.Shadow = tsmiShadow.Checked;
UpdateCurrentShape();
};
tsddbShapeOptions.DropDownItems.Add(tsmiShadow);
// 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 });
@ -902,6 +911,8 @@ private void UpdateMenu()
if (tsbHighlightColor.Image != null) tsbHighlightColor.Image.Dispose(); if (tsbHighlightColor.Image != null) tsbHighlightColor.Image.Dispose();
tsbHighlightColor.Image = ImageHelpers.CreateColorPickerIcon(AnnotationOptions.HighlightColor, new Rectangle(0, 0, 16, 16)); tsbHighlightColor.Image = ImageHelpers.CreateColorPickerIcon(AnnotationOptions.HighlightColor, new Rectangle(0, 0, 16, 16));
tsmiShadow.Checked = AnnotationOptions.Shadow;
switch (shapeType) switch (shapeType)
{ {
default: default:
@ -930,6 +941,7 @@ private void UpdateMenu()
default: default:
tsbBorderColor.Visible = false; tsbBorderColor.Visible = false;
tslnudBorderSize.Visible = false; tslnudBorderSize.Visible = false;
tsmiShadow.Visible = false;
break; break;
case ShapeType.DrawingRectangle: case ShapeType.DrawingRectangle:
case ShapeType.DrawingRoundedRectangle: case ShapeType.DrawingRoundedRectangle:
@ -942,6 +954,7 @@ private void UpdateMenu()
case ShapeType.DrawingStep: case ShapeType.DrawingStep:
tsbBorderColor.Visible = true; tsbBorderColor.Visible = true;
tslnudBorderSize.Visible = true; tslnudBorderSize.Visible = true;
tsmiShadow.Visible = true;
break; break;
} }