diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs
index d10c49a98..f705ddd09 100644
--- a/ShareX.ScreenCaptureLib/Enums.cs
+++ b/ShareX.ScreenCaptureLib/Enums.cs
@@ -179,6 +179,7 @@ public enum ShapeType // Localized
DrawingArrow,
DrawingText,
DrawingStep,
+ DrawingImage,
DrawingBlur,
DrawingPixelate,
DrawingHighlight
diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageDrawingShape.cs
new file mode 100644
index 000000000..78f5cea1a
--- /dev/null
+++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageDrawingShape.cs
@@ -0,0 +1,56 @@
+#region License Information (GPL v3)
+
+/*
+ ShareX - A program that allows you to take screenshots and share any file type
+ Copyright (c) 2007-2016 ShareX Team
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Optionally you can also view the license at .
+*/
+
+#endregion License Information (GPL v3)
+
+using System.Drawing;
+
+namespace ShareX.ScreenCaptureLib
+{
+ public class ImageDrawingShape : BaseDrawingShape
+ {
+ public override ShapeType ShapeType { get; } = ShapeType.DrawingImage;
+
+ public Image Image { get; private set; }
+
+ public void SetImage(Image img, Point pos)
+ {
+ if (Image != null)
+ {
+ Image.Dispose();
+ }
+
+ Image = img;
+
+ Rectangle = new Rectangle(new Point(pos.X - Image.Width / 2, pos.Y - Image.Height / 2), Image.Size);
+ }
+
+ public override void OnDraw(Graphics g)
+ {
+ if (Image != null)
+ {
+ g.DrawImage(Image, Rectangle);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
index 2aadde110..8d97dfa91 100644
--- a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
+++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs
@@ -1109,6 +1109,9 @@ private void form_KeyUp(object sender, KeyEventArgs e)
Config.QuickCrop = !Config.QuickCrop;
tsmiQuickCrop.Checked = !Config.QuickCrop;
break;
+ case Keys.Control | Keys.V:
+ AddImageFromClipboard();
+ break;
}
}
}
@@ -1256,9 +1259,14 @@ private void EndRegionSelection()
private BaseShape AddShape()
{
BaseShape shape = CreateShape();
+ AddShape(shape);
+ return shape;
+ }
+
+ private void AddShape(BaseShape shape)
+ {
Shapes.Add(shape);
CurrentShape = shape;
- return shape;
}
private BaseShape CreateShape()
@@ -1309,6 +1317,9 @@ private BaseShape CreateShape(ShapeType shapeType)
case ShapeType.DrawingStep:
shape = new StepDrawingShape();
break;
+ case ShapeType.DrawingImage:
+ shape = new ImageDrawingShape();
+ break;
case ShapeType.DrawingBlur:
shape = new BlurEffectShape();
break;
@@ -1687,6 +1698,23 @@ public void OrderStepShapes()
}
}
+ private void AddImageFromClipboard()
+ {
+ if (Clipboard.ContainsImage())
+ {
+ Image img = ClipboardHelpers.GetImage();
+
+ if (img != null)
+ {
+ CurrentShapeType = ShapeType.DrawingImage;
+ ImageDrawingShape shape = (ImageDrawingShape)CreateShape(ShapeType.DrawingImage);
+ shape.SetImage(img, InputManager.MousePosition0Based);
+ AddShape(shape);
+ SelectCurrentShape();
+ }
+ }
+ }
+
private void OnCurrentShapeChanged(BaseShape shape)
{
if (CurrentShapeChanged != null)
diff --git a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
index 77878919d..b40dc705a 100644
--- a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
+++ b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj
@@ -93,6 +93,7 @@
+