mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +13:00
Test URL sharing button
This commit is contained in:
parent
410ffdd687
commit
fabf2997f6
6 changed files with 108 additions and 89 deletions
|
@ -48,6 +48,21 @@ public static void DrawRectangleProper(this Graphics g, Pen pen, int x, int y, i
|
||||||
DrawRectangleProper(g, pen, new Rectangle(x, y, width, height));
|
DrawRectangleProper(g, pen, new Rectangle(x, y, width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, Rectangle rect, float radius)
|
||||||
|
{
|
||||||
|
using (GraphicsPath gp = new GraphicsPath())
|
||||||
|
{
|
||||||
|
gp.AddRoundedRectangle(rect, radius);
|
||||||
|
if (brush != null) g.FillPath(brush, gp);
|
||||||
|
if (pen != null) g.DrawPath(pen, gp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawRoundedRectangle(this Graphics g, Brush brush, Pen pen, int x, int y, int width, int height, float radius)
|
||||||
|
{
|
||||||
|
DrawRoundedRectangle(g, brush, pen, new Rectangle(x, y, width, height), radius);
|
||||||
|
}
|
||||||
|
|
||||||
public static void DrawCrossRectangle(this Graphics g, Pen pen, Rectangle rect, int crossSize)
|
public static void DrawCrossRectangle(this Graphics g, Pen pen, Rectangle rect, int crossSize)
|
||||||
{
|
{
|
||||||
rect = rect.SizeOffset(-1);
|
rect = rect.SizeOffset(-1);
|
||||||
|
|
|
@ -175,45 +175,38 @@ public override Image Apply(Image img)
|
||||||
|
|
||||||
if (DrawBackground)
|
if (DrawBackground)
|
||||||
{
|
{
|
||||||
using (GraphicsPath backgroundPath = new GraphicsPath())
|
Rectangle backgroundRect = new Rectangle(0, 0, watermarkSize.Width, watermarkSize.Height);
|
||||||
|
Brush backgroundBrush = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Rectangle backgroundRect = new Rectangle(0, 0, watermarkSize.Width, watermarkSize.Height);
|
if (UseGradient)
|
||||||
backgroundPath.AddRoundedRectangle(backgroundRect, CornerRadius);
|
|
||||||
|
|
||||||
Brush backgroundBrush = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if (UseGradient)
|
backgroundBrush = new LinearGradientBrush(backgroundRect, BackgroundColor, BackgroundColor2, GradientType);
|
||||||
{
|
|
||||||
backgroundBrush = new LinearGradientBrush(backgroundRect, BackgroundColor, BackgroundColor2, GradientType);
|
|
||||||
|
|
||||||
if (UseCustomGradient && CustomGradientList != null && CustomGradientList.Count > 1)
|
if (UseCustomGradient && CustomGradientList != null && CustomGradientList.Count > 1)
|
||||||
{
|
|
||||||
ColorBlend colorBlend = new ColorBlend();
|
|
||||||
IEnumerable<GradientStop> gradient = CustomGradientList.OrderBy(x => x.Offset);
|
|
||||||
colorBlend.Colors = gradient.Select(x => x.Color).ToArray();
|
|
||||||
colorBlend.Positions = gradient.Select(x => x.Offset).ToArray();
|
|
||||||
((LinearGradientBrush)backgroundBrush).InterpolationColors = colorBlend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
backgroundBrush = new SolidBrush(BackgroundColor);
|
ColorBlend colorBlend = new ColorBlend();
|
||||||
|
IEnumerable<GradientStop> gradient = CustomGradientList.OrderBy(x => x.Offset);
|
||||||
|
colorBlend.Colors = gradient.Select(x => x.Color).ToArray();
|
||||||
|
colorBlend.Positions = gradient.Select(x => x.Offset).ToArray();
|
||||||
|
((LinearGradientBrush)backgroundBrush).InterpolationColors = colorBlend;
|
||||||
}
|
}
|
||||||
|
|
||||||
gWatermark.FillPath(backgroundBrush, backgroundPath);
|
|
||||||
}
|
}
|
||||||
finally
|
else
|
||||||
{
|
{
|
||||||
if (backgroundBrush != null) backgroundBrush.Dispose();
|
backgroundBrush = new SolidBrush(BackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Pen borderPen = new Pen(BorderColor))
|
using (Pen borderPen = new Pen(BorderColor))
|
||||||
{
|
{
|
||||||
gWatermark.DrawPath(borderPen, backgroundPath);
|
gWatermark.DrawRoundedRectangle(backgroundBrush, borderPen, backgroundRect, CornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (backgroundBrush != null) backgroundBrush.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gWatermark.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
gWatermark.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||||
|
@ -227,8 +220,7 @@ public override Image Apply(Image img)
|
||||||
{
|
{
|
||||||
using (Brush textShadowBrush = new SolidBrush(TextShadowColor))
|
using (Brush textShadowBrush = new SolidBrush(TextShadowColor))
|
||||||
{
|
{
|
||||||
gWatermark.DrawString(parsedText, textFont, textShadowBrush,
|
gWatermark.DrawString(parsedText, textFont, textShadowBrush, centerX + TextShadowOffset.X, centerY + TextShadowOffset.Y, sf);
|
||||||
centerX + TextShadowOffset.X, centerY + TextShadowOffset.Y, sf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,13 +395,10 @@ private void DrawTips(Graphics g)
|
||||||
textRectangle.Y = ScreenRectangle0Based.Height - rectHeight - offset;
|
textRectangle.Y = ScreenRectangle0Based.Height - rectHeight - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (GraphicsPath backgroundPath = new GraphicsPath())
|
|
||||||
using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
|
using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
|
||||||
using (Pen pen = new Pen(Color.FromArgb(175, Color.Black)))
|
using (Pen pen = new Pen(Color.FromArgb(175, Color.Black)))
|
||||||
{
|
{
|
||||||
backgroundPath.AddRoundedRectangle(textRectangle, 5);
|
g.DrawRoundedRectangle(brush, pen, textRectangle, 5);
|
||||||
g.FillPath(brush, backgroundPath);
|
|
||||||
g.DrawPath(pen, backgroundPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
|
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace ScreenCaptureLib
|
||||||
public class RoundedRectangleRegion : RectangleRegion
|
public class RoundedRectangleRegion : RectangleRegion
|
||||||
{
|
{
|
||||||
public float Radius { get; set; }
|
public float Radius { get; set; }
|
||||||
|
|
||||||
public int RadiusIncrement { get; set; }
|
public int RadiusIncrement { get; set; }
|
||||||
|
|
||||||
public RoundedRectangleRegion(Image backgroundImage = null)
|
public RoundedRectangleRegion(Image backgroundImage = null)
|
||||||
|
|
13
ShareX/Forms/MainForm.Designer.cs
generated
13
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -215,6 +215,7 @@ private void InitializeComponent()
|
||||||
this.tsmiTrayShow = new System.Windows.Forms.ToolStripMenuItem();
|
this.tsmiTrayShow = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.tsmiTestURLSharing = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.tsMain.SuspendLayout();
|
this.tsMain.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
||||||
this.scMain.Panel1.SuspendLayout();
|
this.scMain.Panel1.SuspendLayout();
|
||||||
|
@ -739,6 +740,7 @@ private void InitializeComponent()
|
||||||
this.tsmiTestTextUpload,
|
this.tsmiTestTextUpload,
|
||||||
this.tsmiTestFileUpload,
|
this.tsmiTestFileUpload,
|
||||||
this.tsmiTestURLShortener,
|
this.tsmiTestURLShortener,
|
||||||
|
this.tsmiTestURLSharing,
|
||||||
this.tsmiTestUploaders});
|
this.tsmiTestUploaders});
|
||||||
this.tsddbDebug.Image = global::ShareX.Properties.Resources.traffic_cone;
|
this.tsddbDebug.Image = global::ShareX.Properties.Resources.traffic_cone;
|
||||||
this.tsddbDebug.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.tsddbDebug.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
@ -958,7 +960,7 @@ private void InitializeComponent()
|
||||||
this.tsmiHideMenu,
|
this.tsmiHideMenu,
|
||||||
this.tsmiImagePreview});
|
this.tsmiImagePreview});
|
||||||
this.cmsTaskInfo.Name = "cmsHistory";
|
this.cmsTaskInfo.Name = "cmsHistory";
|
||||||
this.cmsTaskInfo.Size = new System.Drawing.Size(154, 318);
|
this.cmsTaskInfo.Size = new System.Drawing.Size(154, 296);
|
||||||
//
|
//
|
||||||
// tsmiShowErrors
|
// tsmiShowErrors
|
||||||
//
|
//
|
||||||
|
@ -1860,6 +1862,14 @@ private void InitializeComponent()
|
||||||
this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.ssToolStripMenuItem.Text = "ss";
|
this.ssToolStripMenuItem.Text = "ss";
|
||||||
//
|
//
|
||||||
|
// tsmiTestURLSharing
|
||||||
|
//
|
||||||
|
this.tsmiTestURLSharing.Image = global::ShareX.Properties.Resources.globe_share;
|
||||||
|
this.tsmiTestURLSharing.Name = "tsmiTestURLSharing";
|
||||||
|
this.tsmiTestURLSharing.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.tsmiTestURLSharing.Text = "Test URL sharing";
|
||||||
|
this.tsmiTestURLSharing.Click += new System.EventHandler(this.tsmiTestURLSharing_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
|
@ -2079,5 +2089,6 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsmiRectangleAnnotate;
|
private System.Windows.Forms.ToolStripMenuItem tsmiRectangleAnnotate;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayRectangleAnnotate;
|
private System.Windows.Forms.ToolStripMenuItem tsmiTrayRectangleAnnotate;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsmiEditSelectedFile;
|
private System.Windows.Forms.ToolStripMenuItem tsmiEditSelectedFile;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem tsmiTestURLSharing;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -707,6 +707,61 @@ private void tsbDragDropUpload_Click(object sender, EventArgs e)
|
||||||
TaskHelpers.OpenDropWindow();
|
TaskHelpers.OpenDropWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tsmiCursorHelper_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenScreenColorPicker();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiRuler_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenRuler();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiFTPClient_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenFTPClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiHashCheck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenHashCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiIndexFolder_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenIndexFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiImageEditor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenImageEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiImageEffects_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenImageEffects();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiMonitorTest_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenMonitorTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiDNSChanger_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenDNSChanger();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiQRCode_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.OpenQRCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tsmiTweetMessage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TaskHelpers.TweetMessage();
|
||||||
|
}
|
||||||
|
|
||||||
private void tsddbDestinations_DropDownOpened(object sender, EventArgs e)
|
private void tsddbDestinations_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateDestinationStates();
|
UpdateDestinationStates();
|
||||||
|
@ -737,6 +792,11 @@ private void tsmiTestURLShortener_Click(object sender, EventArgs e)
|
||||||
UploadManager.ShortenURL(Links.URL_WEBSITE);
|
UploadManager.ShortenURL(Links.URL_WEBSITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tsmiTestURLSharing_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UploadManager.ShareURL(Links.URL_WEBSITE);
|
||||||
|
}
|
||||||
|
|
||||||
private void tsmiTestUploaders_Click(object sender, EventArgs e)
|
private void tsmiTestUploaders_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (UploadTestForm form = new UploadTestForm())
|
using (UploadTestForm form = new UploadTestForm())
|
||||||
|
@ -810,61 +870,6 @@ private void tsbDestinationSettings_Click(object sender, EventArgs e)
|
||||||
Program.UploadersConfigSaveAsync();
|
Program.UploadersConfigSaveAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsmiCursorHelper_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenScreenColorPicker();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiRuler_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenRuler();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiFTPClient_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenFTPClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiHashCheck_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenHashCheck();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiIndexFolder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenIndexFolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiImageEditor_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenImageEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiImageEffects_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenImageEffects();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiMonitorTest_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenMonitorTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiDNSChanger_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenDNSChanger();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiQRCode_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.OpenQRCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsmiTweetMessage_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
TaskHelpers.TweetMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tsbScreenshotsFolder_Click(object sender, EventArgs e)
|
private void tsbScreenshotsFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(Program.ScreenshotsFolder))
|
if (Directory.Exists(Program.ScreenshotsFolder))
|
||||||
|
|
Loading…
Reference in a new issue