From fc2f5e7ca02cdc1a077be7b21137ba6bc86c5c8d Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 7 Jun 2023 08:37:52 +0300 Subject: [PATCH] Added more shadow options to image beautifier --- ShareX.HelpersLib/Helpers/ImageHelpers.cs | 2 +- .../Forms/ImageBeautifierForm.Designer.cs | 196 ++++++++++++++++-- ShareX.MediaLib/Forms/ImageBeautifierForm.cs | 69 +++++- ShareX.MediaLib/ImageBeautifierOptions.cs | 14 +- .../Properties/Resources.Designer.cs | 20 ++ ShareX.MediaLib/Properties/Resources.resx | 22 +- ShareX.MediaLib/Resources/minus-white.png | Bin 0 -> 625 bytes ShareX.MediaLib/Resources/plus-white.png | Bin 0 -> 648 bytes ShareX.MediaLib/ShareX.MediaLib.csproj | 6 + 9 files changed, 293 insertions(+), 36 deletions(-) create mode 100644 ShareX.MediaLib/Resources/minus-white.png create mode 100644 ShareX.MediaLib/Resources/plus-white.png diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index 08b18eda2..39d504c4e 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -1191,7 +1191,7 @@ public static Bitmap AddShadow(Bitmap bmp, float opacity, int size, float darkne using (Graphics g = Graphics.FromImage(bmpResult)) { g.SetHighQuality(); - g.DrawImage(bmpShadow, -size + Math.Max(0, offset.X), -size + Math.Max(0, offset.Y), bmpShadow.Width, bmpShadow.Height); + g.DrawImage(bmpShadow, -size + offset.X, -size + offset.Y, bmpShadow.Width, bmpShadow.Height); g.DrawImage(bmp, 0, 0, bmp.Width, bmp.Height); } } diff --git a/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs b/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs index d7c870255..70ffd3fad 100644 --- a/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs +++ b/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs @@ -46,6 +46,18 @@ private void InitializeComponent() this.tlpMain = new System.Windows.Forms.TableLayoutPanel(); this.pbPreview = new ShareX.HelpersLib.MyPictureBox(); this.pOptions = new System.Windows.Forms.Panel(); + this.gbShadow = new System.Windows.Forms.GroupBox(); + this.btnShadowExpand = new System.Windows.Forms.Button(); + this.lblShadowAngleValue = new System.Windows.Forms.Label(); + this.lblShadowDistanceValue = new System.Windows.Forms.Label(); + this.lblShadowOpacityValue = new System.Windows.Forms.Label(); + this.btnShadowColor = new ShareX.HelpersLib.ColorButton(); + this.tbShadowAngle = new System.Windows.Forms.TrackBar(); + this.lblShadowAngle = new System.Windows.Forms.Label(); + this.tbShadowDistance = new System.Windows.Forms.TrackBar(); + this.lblShadowOpacity = new System.Windows.Forms.Label(); + this.lblShadowDistance = new System.Windows.Forms.Label(); + this.tbShadowOpacity = new System.Windows.Forms.TrackBar(); this.btnResetOptions = new System.Windows.Forms.Button(); this.lblBackgroundImageFilePath = new System.Windows.Forms.Label(); this.btnBackgroundImageFilePathBrowse = new System.Windows.Forms.Button(); @@ -63,6 +75,10 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.tbShadowSize)).BeginInit(); this.tlpMain.SuspendLayout(); this.pOptions.SuspendLayout(); + this.gbShadow.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowAngle)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowDistance)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowOpacity)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbBackground)).BeginInit(); this.SuspendLayout(); // @@ -147,20 +163,21 @@ private void InitializeComponent() // lblShadowSize // this.lblShadowSize.AutoSize = true; - this.lblShadowSize.Location = new System.Drawing.Point(13, 264); + this.lblShadowSize.Location = new System.Drawing.Point(16, 32); this.lblShadowSize.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblShadowSize.Name = "lblShadowSize"; - this.lblShadowSize.Size = new System.Drawing.Size(83, 17); + this.lblShadowSize.Size = new System.Drawing.Size(34, 17); this.lblShadowSize.TabIndex = 10; - this.lblShadowSize.Text = "Shadow size:"; + this.lblShadowSize.Text = "Size:"; // // tbShadowSize // - this.tbShadowSize.Location = new System.Drawing.Point(16, 288); + this.tbShadowSize.AutoSize = false; + this.tbShadowSize.Location = new System.Drawing.Point(16, 56); this.tbShadowSize.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.tbShadowSize.Maximum = 100; this.tbShadowSize.Name = "tbShadowSize"; - this.tbShadowSize.Size = new System.Drawing.Size(296, 45); + this.tbShadowSize.Size = new System.Drawing.Size(280, 32); this.tbShadowSize.TabIndex = 11; this.tbShadowSize.TickFrequency = 5; this.tbShadowSize.Scroll += new System.EventHandler(this.tbShadowSize_Scroll); @@ -168,7 +185,7 @@ private void InitializeComponent() // lblBackground // this.lblBackground.AutoSize = true; - this.lblBackground.Location = new System.Drawing.Point(13, 336); + this.lblBackground.Location = new System.Drawing.Point(13, 376); this.lblBackground.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblBackground.Name = "lblBackground"; this.lblBackground.Size = new System.Drawing.Size(80, 17); @@ -207,7 +224,7 @@ private void InitializeComponent() // // lblShadowSizeValue // - this.lblShadowSizeValue.Location = new System.Drawing.Point(272, 264); + this.lblShadowSizeValue.Location = new System.Drawing.Point(256, 32); this.lblShadowSizeValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblShadowSizeValue.Name = "lblShadowSizeValue"; this.lblShadowSizeValue.Size = new System.Drawing.Size(40, 24); @@ -247,6 +264,8 @@ private void InitializeComponent() // // pOptions // + this.pOptions.Controls.Add(this.btnShadowExpand); + this.pOptions.Controls.Add(this.gbShadow); this.pOptions.Controls.Add(this.btnResetOptions); this.pOptions.Controls.Add(this.lblBackgroundImageFilePath); this.pOptions.Controls.Add(this.btnBackgroundImageFilePathBrowse); @@ -258,7 +277,6 @@ private void InitializeComponent() this.pOptions.Controls.Add(this.btnCopy); this.pOptions.Controls.Add(this.pbBackground); this.pOptions.Controls.Add(this.lblMargin); - this.pOptions.Controls.Add(this.lblShadowSizeValue); this.pOptions.Controls.Add(this.tbMargin); this.pOptions.Controls.Add(this.lblRoundedCornerValue); this.pOptions.Controls.Add(this.lblPadding); @@ -269,14 +287,147 @@ private void InitializeComponent() this.pOptions.Controls.Add(this.lblRoundedCorner); this.pOptions.Controls.Add(this.lblBackground); this.pOptions.Controls.Add(this.tbRoundedCorner); - this.pOptions.Controls.Add(this.tbShadowSize); - this.pOptions.Controls.Add(this.lblShadowSize); this.pOptions.Dock = System.Windows.Forms.DockStyle.Fill; this.pOptions.Location = new System.Drawing.Point(3, 3); this.pOptions.Name = "pOptions"; this.pOptions.Size = new System.Drawing.Size(329, 755); this.pOptions.TabIndex = 0; // + // gbShadow + // + this.gbShadow.Controls.Add(this.lblShadowAngleValue); + this.gbShadow.Controls.Add(this.lblShadowDistanceValue); + this.gbShadow.Controls.Add(this.lblShadowOpacityValue); + this.gbShadow.Controls.Add(this.btnShadowColor); + this.gbShadow.Controls.Add(this.tbShadowSize); + this.gbShadow.Controls.Add(this.tbShadowAngle); + this.gbShadow.Controls.Add(this.lblShadowSizeValue); + this.gbShadow.Controls.Add(this.lblShadowAngle); + this.gbShadow.Controls.Add(this.lblShadowSize); + this.gbShadow.Controls.Add(this.tbShadowDistance); + this.gbShadow.Controls.Add(this.lblShadowOpacity); + this.gbShadow.Controls.Add(this.lblShadowDistance); + this.gbShadow.Controls.Add(this.tbShadowOpacity); + this.gbShadow.Location = new System.Drawing.Point(8, 264); + this.gbShadow.Name = "gbShadow"; + this.gbShadow.Size = new System.Drawing.Size(312, 104); + this.gbShadow.TabIndex = 25; + this.gbShadow.TabStop = false; + this.gbShadow.Text = "Shadow"; + // + // btnShadowExpand + // + this.btnShadowExpand.Image = global::ShareX.MediaLib.Properties.Resources.plus_white; + this.btnShadowExpand.Location = new System.Drawing.Point(280, 260); + this.btnShadowExpand.Name = "btnShadowExpand"; + this.btnShadowExpand.Size = new System.Drawing.Size(30, 30); + this.btnShadowExpand.TabIndex = 16; + this.btnShadowExpand.Tag = "+"; + this.btnShadowExpand.UseVisualStyleBackColor = true; + this.btnShadowExpand.Click += new System.EventHandler(this.btnShadowExpand_Click); + // + // lblShadowAngleValue + // + this.lblShadowAngleValue.Location = new System.Drawing.Point(256, 248); + this.lblShadowAngleValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblShadowAngleValue.Name = "lblShadowAngleValue"; + this.lblShadowAngleValue.Size = new System.Drawing.Size(40, 24); + this.lblShadowAngleValue.TabIndex = 15; + this.lblShadowAngleValue.Text = "0"; + this.lblShadowAngleValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblShadowDistanceValue + // + this.lblShadowDistanceValue.Location = new System.Drawing.Point(256, 176); + this.lblShadowDistanceValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblShadowDistanceValue.Name = "lblShadowDistanceValue"; + this.lblShadowDistanceValue.Size = new System.Drawing.Size(40, 24); + this.lblShadowDistanceValue.TabIndex = 14; + this.lblShadowDistanceValue.Text = "0"; + this.lblShadowDistanceValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblShadowOpacityValue + // + this.lblShadowOpacityValue.Location = new System.Drawing.Point(256, 104); + this.lblShadowOpacityValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblShadowOpacityValue.Name = "lblShadowOpacityValue"; + this.lblShadowOpacityValue.Size = new System.Drawing.Size(40, 24); + this.lblShadowOpacityValue.TabIndex = 13; + this.lblShadowOpacityValue.Text = "0"; + this.lblShadowOpacityValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // btnShadowColor + // + this.btnShadowColor.Color = System.Drawing.Color.Empty; + this.btnShadowColor.ColorPickerOptions = null; + this.btnShadowColor.Location = new System.Drawing.Point(16, 320); + this.btnShadowColor.Name = "btnShadowColor"; + this.btnShadowColor.Size = new System.Drawing.Size(280, 32); + this.btnShadowColor.TabIndex = 6; + this.btnShadowColor.Text = "Color..."; + this.btnShadowColor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.btnShadowColor.UseVisualStyleBackColor = true; + this.btnShadowColor.ColorChanged += new ShareX.HelpersLib.ColorButton.ColorChangedEventHandler(this.btnShadowColor_ColorChanged); + // + // tbShadowAngle + // + this.tbShadowAngle.Location = new System.Drawing.Point(16, 272); + this.tbShadowAngle.Maximum = 180; + this.tbShadowAngle.Minimum = -180; + this.tbShadowAngle.Name = "tbShadowAngle"; + this.tbShadowAngle.Size = new System.Drawing.Size(280, 45); + this.tbShadowAngle.TabIndex = 5; + this.tbShadowAngle.TickFrequency = 45; + this.tbShadowAngle.Scroll += new System.EventHandler(this.tbShadowAngle_Scroll); + // + // lblShadowAngle + // + this.lblShadowAngle.AutoSize = true; + this.lblShadowAngle.Location = new System.Drawing.Point(16, 248); + this.lblShadowAngle.Name = "lblShadowAngle"; + this.lblShadowAngle.Size = new System.Drawing.Size(44, 17); + this.lblShadowAngle.TabIndex = 4; + this.lblShadowAngle.Text = "Angle:"; + // + // tbShadowDistance + // + this.tbShadowDistance.Location = new System.Drawing.Point(16, 200); + this.tbShadowDistance.Maximum = 100; + this.tbShadowDistance.Name = "tbShadowDistance"; + this.tbShadowDistance.Size = new System.Drawing.Size(280, 45); + this.tbShadowDistance.TabIndex = 3; + this.tbShadowDistance.TickFrequency = 10; + this.tbShadowDistance.Scroll += new System.EventHandler(this.tbShadowDistance_Scroll); + // + // lblShadowOpacity + // + this.lblShadowOpacity.AutoSize = true; + this.lblShadowOpacity.Location = new System.Drawing.Point(16, 104); + this.lblShadowOpacity.Name = "lblShadowOpacity"; + this.lblShadowOpacity.Size = new System.Drawing.Size(55, 17); + this.lblShadowOpacity.TabIndex = 0; + this.lblShadowOpacity.Text = "Opacity:"; + // + // lblShadowDistance + // + this.lblShadowDistance.AutoSize = true; + this.lblShadowDistance.Location = new System.Drawing.Point(16, 176); + this.lblShadowDistance.Name = "lblShadowDistance"; + this.lblShadowDistance.Size = new System.Drawing.Size(60, 17); + this.lblShadowDistance.TabIndex = 2; + this.lblShadowDistance.Text = "Distance:"; + // + // tbShadowOpacity + // + this.tbShadowOpacity.Location = new System.Drawing.Point(16, 128); + this.tbShadowOpacity.Maximum = 100; + this.tbShadowOpacity.Name = "tbShadowOpacity"; + this.tbShadowOpacity.Size = new System.Drawing.Size(280, 45); + this.tbShadowOpacity.SmallChange = 10; + this.tbShadowOpacity.TabIndex = 1; + this.tbShadowOpacity.TickFrequency = 10; + this.tbShadowOpacity.Scroll += new System.EventHandler(this.tbShadowOpacity_Scroll); + // // btnResetOptions // this.btnResetOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -290,14 +441,14 @@ private void InitializeComponent() // // lblBackgroundImageFilePath // - this.lblBackgroundImageFilePath.Location = new System.Drawing.Point(13, 432); + this.lblBackgroundImageFilePath.Location = new System.Drawing.Point(13, 472); this.lblBackgroundImageFilePath.Name = "lblBackgroundImageFilePath"; this.lblBackgroundImageFilePath.Size = new System.Drawing.Size(296, 120); this.lblBackgroundImageFilePath.TabIndex = 22; // // btnBackgroundImageFilePathBrowse // - this.btnBackgroundImageFilePathBrowse.Location = new System.Drawing.Point(16, 392); + this.btnBackgroundImageFilePathBrowse.Location = new System.Drawing.Point(16, 432); this.btnBackgroundImageFilePathBrowse.Name = "btnBackgroundImageFilePathBrowse"; this.btnBackgroundImageFilePathBrowse.Size = new System.Drawing.Size(296, 32); this.btnBackgroundImageFilePathBrowse.TabIndex = 21; @@ -309,7 +460,7 @@ private void InitializeComponent() // this.cbBackgroundType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbBackgroundType.FormattingEnabled = true; - this.cbBackgroundType.Location = new System.Drawing.Point(16, 360); + this.cbBackgroundType.Location = new System.Drawing.Point(16, 400); this.cbBackgroundType.Name = "cbBackgroundType"; this.cbBackgroundType.Size = new System.Drawing.Size(296, 25); this.cbBackgroundType.TabIndex = 19; @@ -378,7 +529,7 @@ private void InitializeComponent() // pbBackground // this.pbBackground.Cursor = System.Windows.Forms.Cursors.Hand; - this.pbBackground.Location = new System.Drawing.Point(16, 392); + this.pbBackground.Location = new System.Drawing.Point(16, 432); this.pbBackground.Name = "pbBackground"; this.pbBackground.Size = new System.Drawing.Size(296, 40); this.pbBackground.TabIndex = 14; @@ -406,6 +557,11 @@ private void InitializeComponent() this.tlpMain.ResumeLayout(false); this.pOptions.ResumeLayout(false); this.pOptions.PerformLayout(); + this.gbShadow.ResumeLayout(false); + this.gbShadow.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowAngle)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowDistance)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbShadowOpacity)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbBackground)).EndInit(); this.ResumeLayout(false); @@ -440,5 +596,17 @@ private void InitializeComponent() private System.Windows.Forms.Button btnBackgroundImageFilePathBrowse; private System.Windows.Forms.Label lblBackgroundImageFilePath; private System.Windows.Forms.Button btnResetOptions; + private System.Windows.Forms.TrackBar tbShadowOpacity; + private System.Windows.Forms.Label lblShadowOpacity; + private HelpersLib.ColorButton btnShadowColor; + private System.Windows.Forms.TrackBar tbShadowAngle; + private System.Windows.Forms.Label lblShadowAngle; + private System.Windows.Forms.TrackBar tbShadowDistance; + private System.Windows.Forms.Label lblShadowDistance; + private System.Windows.Forms.GroupBox gbShadow; + private System.Windows.Forms.Label lblShadowAngleValue; + private System.Windows.Forms.Label lblShadowDistanceValue; + private System.Windows.Forms.Label lblShadowOpacityValue; + private System.Windows.Forms.Button btnShadowExpand; } } \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs index 9aced1101..ad97e5fdb 100644 --- a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs +++ b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs @@ -62,6 +62,17 @@ private ImageBeautifierForm(ImageBeautifierOptions options = null) LoadOptions(); } + public ImageBeautifierForm(Bitmap sourceImage, ImageBeautifierOptions options = null) : this(options) + { + SourceImage = sourceImage; + } + + public ImageBeautifierForm(string filePath, ImageBeautifierOptions options = null) : this(options) + { + FilePath = filePath; + SourceImage = ImageHelpers.LoadImage(filePath); + } + private void LoadOptions() { isReady = false; @@ -71,6 +82,10 @@ private void LoadOptions() cbSmartPadding.Checked = Options.SmartPadding; tbRoundedCorner.SetValue(Options.RoundedCorner); tbShadowSize.SetValue(Options.ShadowSize); + tbShadowOpacity.SetValue(Options.ShadowOpacity); + tbShadowDistance.SetValue(Options.ShadowDistance); + tbShadowAngle.SetValue(Options.ShadowAngle); + btnShadowColor.Color = Options.ShadowColor; if (cbBackgroundType.Items.Count == 0) { cbBackgroundType.Items.AddRange(Helpers.GetLocalizedEnumDescriptions()); @@ -83,23 +98,15 @@ private void LoadOptions() isReady = true; } - public ImageBeautifierForm(Bitmap sourceImage, ImageBeautifierOptions options = null) : this(options) - { - SourceImage = sourceImage; - } - - public ImageBeautifierForm(string filePath, ImageBeautifierOptions options = null) : this(options) - { - FilePath = filePath; - SourceImage = ImageHelpers.LoadImage(filePath); - } - private void UpdateUI() { lblMarginValue.Text = tbMargin.Value.ToString(); lblPaddingValue.Text = tbPadding.Value.ToString(); lblRoundedCornerValue.Text = tbRoundedCorner.Value.ToString(); lblShadowSizeValue.Text = tbShadowSize.Value.ToString(); + lblShadowOpacityValue.Text = tbShadowOpacity.Value.ToString(); + lblShadowDistanceValue.Text = tbShadowDistance.Value.ToString(); + lblShadowAngleValue.Text = tbShadowAngle.Value.ToString(); lblBackgroundImageFilePath.Text = Options.BackgroundImageFilePath; } @@ -199,6 +206,10 @@ private void UpdateOptions() Options.SmartPadding = cbSmartPadding.Checked; Options.RoundedCorner = tbRoundedCorner.Value; Options.ShadowSize = tbShadowSize.Value; + Options.ShadowOpacity = tbShadowOpacity.Value; + Options.ShadowDistance = tbShadowDistance.Value; + Options.ShadowAngle = tbShadowAngle.Value; + Options.ShadowColor = btnShadowColor.Color; } private void OnUploadImageRequested() @@ -251,11 +262,47 @@ private async void tbRoundedCorner_MouseUp(object sender, MouseEventArgs e) await UpdatePreview(); } + private void btnShadowExpand_Click(object sender, EventArgs e) + { + if (btnShadowExpand.Tag is "+") + { + gbShadow.Size = new Size(gbShadow.Width, 368); + btnShadowExpand.Image = Resources.minus_white; + btnShadowExpand.Tag = "-"; + } + else + { + gbShadow.Size = new Size(gbShadow.Width, 104); + btnShadowExpand.Image = Resources.plus_white; + btnShadowExpand.Tag = "+"; + } + } + private async void tbShadowSize_Scroll(object sender, EventArgs e) { await UpdatePreview(); } + private async void tbShadowOpacity_Scroll(object sender, EventArgs e) + { + await UpdatePreview(); + } + + private async void tbShadowDistance_Scroll(object sender, EventArgs e) + { + await UpdatePreview(); + } + + private async void tbShadowAngle_Scroll(object sender, EventArgs e) + { + await UpdatePreview(); + } + + private async void btnShadowColor_ColorChanged(Color color) + { + await UpdatePreview(); + } + private async void cbBackgroundType_SelectedIndexChanged(object sender, EventArgs e) { Options.BackgroundType = (ImageBeautifierBackgroundType)cbBackgroundType.SelectedIndex; diff --git a/ShareX.MediaLib/ImageBeautifierOptions.cs b/ShareX.MediaLib/ImageBeautifierOptions.cs index 9fd840cdf..00133b85f 100644 --- a/ShareX.MediaLib/ImageBeautifierOptions.cs +++ b/ShareX.MediaLib/ImageBeautifierOptions.cs @@ -38,6 +38,10 @@ public class ImageBeautifierOptions public bool SmartPadding { get; set; } public int RoundedCorner { get; set; } public int ShadowSize { get; set; } + public int ShadowOpacity { get; set; } + public int ShadowDistance { get; set; } + public int ShadowAngle { get; set; } + public Color ShadowColor { get; set; } public ImageBeautifierBackgroundType BackgroundType { get; set; } public GradientInfo BackgroundGradient { get; set; } public Color BackgroundColor { get; set; } @@ -55,6 +59,10 @@ public void ResetOptions() SmartPadding = true; RoundedCorner = 20; ShadowSize = 30; + ShadowOpacity = 100; + ShadowDistance = 0; + ShadowAngle = -90; + ShadowColor = Color.Black; BackgroundType = ImageBeautifierBackgroundType.Gradient; BackgroundGradient = new GradientInfo(LinearGradientMode.ForwardDiagonal, Color.FromArgb(255, 81, 47), Color.FromArgb(221, 36, 118)); BackgroundColor = Color.FromArgb(34, 34, 34); @@ -89,9 +97,11 @@ public Bitmap Render(Bitmap image) resultImage = resultImageNew; } - if (ShadowSize > 0) + if (ShadowOpacity > 0 && (ShadowSize > 0 || ShadowDistance > 0)) { - resultImage = ImageHelpers.AddShadow(resultImage, 1f, ShadowSize, 0f, Color.Black, new Point(0, 0), false); + float shadowOpacity = ShadowOpacity / 100f; + Point shadowOffset = (Point)MathHelpers.DegreeToVector2(ShadowAngle, ShadowDistance); + resultImage = ImageHelpers.AddShadow(resultImage, shadowOpacity, ShadowSize, 0f, ShadowColor, shadowOffset, false); } switch (BackgroundType) diff --git a/ShareX.MediaLib/Properties/Resources.Designer.cs b/ShareX.MediaLib/Properties/Resources.Designer.cs index e906f2ed8..9c4800c3d 100644 --- a/ShareX.MediaLib/Properties/Resources.Designer.cs +++ b/ShareX.MediaLib/Properties/Resources.Designer.cs @@ -180,6 +180,26 @@ internal static string LowerQualitySize { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap minus_white { + get { + object obj = ResourceManager.GetObject("minus-white", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap plus_white { + get { + object obj = ResourceManager.GetObject("plus-white", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShareX.MediaLib/Properties/Resources.resx b/ShareX.MediaLib/Properties/Resources.resx index fc008ac63..25083bc23 100644 --- a/ShareX.MediaLib/Properties/Resources.resx +++ b/ShareX.MediaLib/Properties/Resources.resx @@ -139,12 +139,18 @@ Bottom + + Would you like to reset options? + Right Start encoding + + ..\Resources\plus-white.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + FFmpeg error @@ -157,25 +163,25 @@ Browse for media file + + ..\Resources\printer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Left Center + + Confirmation + Lower quality/size ..\Resources\disk-black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\printer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Confirmation - - - Would you like to reset options? + + ..\Resources\minus-white.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/ShareX.MediaLib/Resources/minus-white.png b/ShareX.MediaLib/Resources/minus-white.png new file mode 100644 index 0000000000000000000000000000000000000000..dba9c486971e53a2db7061ff3057ca07b2782fa4 GIT binary patch literal 625 zcmV-%0*?KOP)3)32mvp-R4J9R5t}C2 z-Rw_i-nt75HJ1*|+qW~{_r007vxPX0;UXr`QhT-!#bOC`{W2(uTID!y6T@rhi~n$4 z^t~vGny%{{_WP$W91fuMb~zD94FT&Mj2pGvMdQJ(OE5c=q>rt@Jm`$fR@>P?%oc{; zH3^c|LYBK;DZs+j5-i=6jaR!rn*At(RD`3&_x)-V*p2%7oHRef z(K`e|kaLPrjxdBJP9`uI3^!Nr>BfASKbM>nLCnfs-5^fZg5$Vrt4n1DNR9TR(FknY zVf!!)Se)ktxPL=~osTYE@(Us9pIfZXYWVcv@$>I+b~Zp!B8Kb?QPe<^rtk~tuw4(J zGR-qi)`B2t05MfEo=8@dB4Y7^k;XV_3yLz;?f$gQE1CzNwjWL$oL(=2BP-!#0;)Q_ z_oeNdPadgQfjv<`mK8YYj2S0uL6%F+R=d!%`YM*IV%f@n{nu|9zIMbOaWVm(7Z1Ha z*?Rpx@J{~73@8YBr`R!)-+Ta%u*AttB2AWc8pF#Sw^6$z8Ox>!b7hWQ?vWM3{x=_5 zZNF!`ac-0gG_orjCs>7)#%RLM{h83IY<6-OdhmI-k_cSH{t7SvZM+RG=2U-c00000 LNkvXXu0mjf5;Gu~ literal 0 HcmV?d00001 diff --git a/ShareX.MediaLib/Resources/plus-white.png b/ShareX.MediaLib/Resources/plus-white.png new file mode 100644 index 0000000000000000000000000000000000000000..e9ba4b96ca6ec862b12b19e524dcea94406cb178 GIT binary patch literal 648 zcmV;30(bq1P)N`F7rX^L=mM%)U*8VF*_l5J*zn5R`1YyWeP>LA%|8^1JCMK|H8nL4fmO;aFVB}UBCP!7{^~SGKBM2Z)BH+Vy-E81>iYp64 z%5cAcYw$de9&LvKW8`oTHK;`oPta<$muAOxV|YO1W<;~uWQf-+3DwLz)D86TBXqm= z-0b846T|~!%CmTH?i;o%)h8} z=F4ghGJPWR@Cqa;2@ql>=TZE>?=H~`rio)6OF+o=di{4Ne>3So<>M3=KYsp$&0B9r zIcHg?a9~CrUZbYqEzVIV|j zh}Vdt6BTx9vV|U=KosSD$0N(DA3W#yRAoX*BJg!B!+u!kI(FF8$_Z@QnZ;vTg%WevVgLM@D6nkyX5V+< i+eRizaFy{_fB^t{+6TRHzVy)m0000 + + + + + +