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));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
rect = rect.SizeOffset(-1);
|
||||
|
|
|
@ -175,45 +175,38 @@ public override Image Apply(Image img)
|
|||
|
||||
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);
|
||||
backgroundPath.AddRoundedRectangle(backgroundRect, CornerRadius);
|
||||
|
||||
Brush backgroundBrush = null;
|
||||
|
||||
try
|
||||
if (UseGradient)
|
||||
{
|
||||
if (UseGradient)
|
||||
{
|
||||
backgroundBrush = new LinearGradientBrush(backgroundRect, BackgroundColor, BackgroundColor2, GradientType);
|
||||
backgroundBrush = new LinearGradientBrush(backgroundRect, BackgroundColor, BackgroundColor2, GradientType);
|
||||
|
||||
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
|
||||
if (UseCustomGradient && CustomGradientList != null && CustomGradientList.Count > 1)
|
||||
{
|
||||
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))
|
||||
{
|
||||
gWatermark.DrawPath(borderPen, backgroundPath);
|
||||
gWatermark.DrawRoundedRectangle(backgroundBrush, borderPen, backgroundRect, CornerRadius);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (backgroundBrush != null) backgroundBrush.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
gWatermark.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||
|
@ -227,8 +220,7 @@ public override Image Apply(Image img)
|
|||
{
|
||||
using (Brush textShadowBrush = new SolidBrush(TextShadowColor))
|
||||
{
|
||||
gWatermark.DrawString(parsedText, textFont, textShadowBrush,
|
||||
centerX + TextShadowOffset.X, centerY + TextShadowOffset.Y, sf);
|
||||
gWatermark.DrawString(parsedText, textFont, textShadowBrush, centerX + TextShadowOffset.X, centerY + TextShadowOffset.Y, sf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -395,13 +395,10 @@ private void DrawTips(Graphics g)
|
|||
textRectangle.Y = ScreenRectangle0Based.Height - rectHeight - offset;
|
||||
}
|
||||
|
||||
using (GraphicsPath backgroundPath = new GraphicsPath())
|
||||
using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
|
||||
using (Pen pen = new Pen(Color.FromArgb(175, Color.Black)))
|
||||
{
|
||||
backgroundPath.AddRoundedRectangle(textRectangle, 5);
|
||||
g.FillPath(brush, backgroundPath);
|
||||
g.DrawPath(pen, backgroundPath);
|
||||
g.DrawRoundedRectangle(brush, pen, textRectangle, 5);
|
||||
}
|
||||
|
||||
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace ScreenCaptureLib
|
|||
public class RoundedRectangleRegion : RectangleRegion
|
||||
{
|
||||
public float Radius { get; set; }
|
||||
|
||||
public int RadiusIncrement { get; set; }
|
||||
|
||||
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.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTestURLSharing = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsMain.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
|
@ -739,6 +740,7 @@ private void InitializeComponent()
|
|||
this.tsmiTestTextUpload,
|
||||
this.tsmiTestFileUpload,
|
||||
this.tsmiTestURLShortener,
|
||||
this.tsmiTestURLSharing,
|
||||
this.tsmiTestUploaders});
|
||||
this.tsddbDebug.Image = global::ShareX.Properties.Resources.traffic_cone;
|
||||
this.tsddbDebug.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
@ -958,7 +960,7 @@ private void InitializeComponent()
|
|||
this.tsmiHideMenu,
|
||||
this.tsmiImagePreview});
|
||||
this.cmsTaskInfo.Name = "cmsHistory";
|
||||
this.cmsTaskInfo.Size = new System.Drawing.Size(154, 318);
|
||||
this.cmsTaskInfo.Size = new System.Drawing.Size(154, 296);
|
||||
//
|
||||
// tsmiShowErrors
|
||||
//
|
||||
|
@ -1860,6 +1862,14 @@ private void InitializeComponent()
|
|||
this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
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
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -2079,5 +2089,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem tsmiRectangleAnnotate;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayRectangleAnnotate;
|
||||
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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
UpdateDestinationStates();
|
||||
|
@ -737,6 +792,11 @@ private void tsmiTestURLShortener_Click(object sender, EventArgs e)
|
|||
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)
|
||||
{
|
||||
using (UploadTestForm form = new UploadTestForm())
|
||||
|
@ -810,61 +870,6 @@ private void tsbDestinationSettings_Click(object sender, EventArgs e)
|
|||
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)
|
||||
{
|
||||
if (Directory.Exists(Program.ScreenshotsFolder))
|
||||
|
|
Loading…
Reference in a new issue