diff --git a/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs b/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs index 777e51e90..845e6ccb5 100644 --- a/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs +++ b/ShareX.MediaLib/Forms/ImageBeautifierForm.Designer.cs @@ -43,9 +43,14 @@ private void InitializeComponent() this.lblRoundedCornerValue = new System.Windows.Forms.Label(); this.lblShadowSizeValue = new System.Windows.Forms.Label(); this.tlpMain = new System.Windows.Forms.TableLayoutPanel(); - this.pOptions = new System.Windows.Forms.Panel(); - this.pbBackground = new System.Windows.Forms.PictureBox(); this.pbPreview = new ShareX.HelpersLib.MyPictureBox(); + this.pOptions = new System.Windows.Forms.Panel(); + this.btnPrint = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + this.btnUpload = new System.Windows.Forms.Button(); + this.btnSaveAs = new System.Windows.Forms.Button(); + this.btnCopy = new System.Windows.Forms.Button(); + this.pbBackground = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.tbMargin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbPadding)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbRoundedCorner)).BeginInit(); @@ -216,8 +221,28 @@ private void InitializeComponent() this.tlpMain.Size = new System.Drawing.Size(1384, 761); this.tlpMain.TabIndex = 15; // + // pbPreview + // + this.pbPreview.BackColor = System.Drawing.SystemColors.Window; + this.pbPreview.Dock = System.Windows.Forms.DockStyle.Fill; + this.pbPreview.DrawCheckeredBackground = true; + this.pbPreview.EnableRightClickMenu = true; + this.pbPreview.FullscreenOnClick = true; + this.pbPreview.Location = new System.Drawing.Point(335, 0); + this.pbPreview.Margin = new System.Windows.Forms.Padding(0); + this.pbPreview.Name = "pbPreview"; + this.pbPreview.PictureBoxBackColor = System.Drawing.SystemColors.Window; + this.pbPreview.ShowImageSizeLabel = true; + this.pbPreview.Size = new System.Drawing.Size(1049, 761); + this.pbPreview.TabIndex = 12; + // // pOptions // + this.pOptions.Controls.Add(this.btnPrint); + this.pOptions.Controls.Add(this.btnSave); + this.pOptions.Controls.Add(this.btnUpload); + this.pOptions.Controls.Add(this.btnSaveAs); + this.pOptions.Controls.Add(this.btnCopy); this.pOptions.Controls.Add(this.pbBackground); this.pOptions.Controls.Add(this.lblMargin); this.pOptions.Controls.Add(this.lblShadowSizeValue); @@ -239,6 +264,60 @@ private void InitializeComponent() this.pOptions.Size = new System.Drawing.Size(329, 755); this.pOptions.TabIndex = 0; // + // btnPrint + // + this.btnPrint.Image = global::ShareX.MediaLib.Properties.Resources.printer; + this.btnPrint.Location = new System.Drawing.Point(264, 696); + this.btnPrint.Name = "btnPrint"; + this.btnPrint.Size = new System.Drawing.Size(56, 48); + this.btnPrint.TabIndex = 19; + this.btnPrint.UseVisualStyleBackColor = true; + this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); + // + // btnSave + // + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSave.Image = global::ShareX.MediaLib.Properties.Resources.disk_black; + this.btnSave.Location = new System.Drawing.Point(72, 696); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(56, 48); + this.btnSave.TabIndex = 18; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // btnUpload + // + this.btnUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnUpload.Image = global::ShareX.MediaLib.Properties.Resources.upload_cloud; + this.btnUpload.Location = new System.Drawing.Point(200, 696); + this.btnUpload.Name = "btnUpload"; + this.btnUpload.Size = new System.Drawing.Size(56, 48); + this.btnUpload.TabIndex = 17; + this.btnUpload.UseVisualStyleBackColor = true; + this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click); + // + // btnSaveAs + // + this.btnSaveAs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSaveAs.Image = global::ShareX.MediaLib.Properties.Resources.disks_black; + this.btnSaveAs.Location = new System.Drawing.Point(136, 696); + this.btnSaveAs.Name = "btnSaveAs"; + this.btnSaveAs.Size = new System.Drawing.Size(56, 48); + this.btnSaveAs.TabIndex = 16; + this.btnSaveAs.UseVisualStyleBackColor = true; + this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click); + // + // btnCopy + // + this.btnCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnCopy.Image = global::ShareX.MediaLib.Properties.Resources.document_copy; + this.btnCopy.Location = new System.Drawing.Point(8, 696); + this.btnCopy.Name = "btnCopy"; + this.btnCopy.Size = new System.Drawing.Size(56, 48); + this.btnCopy.TabIndex = 15; + this.btnCopy.UseVisualStyleBackColor = true; + this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click); + // // pbBackground // this.pbBackground.Cursor = System.Windows.Forms.Cursors.Hand; @@ -249,18 +328,6 @@ private void InitializeComponent() this.pbBackground.TabStop = false; this.pbBackground.Click += new System.EventHandler(this.pbBackground_Click); // - // pbPreview - // - this.pbPreview.BackColor = System.Drawing.SystemColors.Window; - this.pbPreview.Dock = System.Windows.Forms.DockStyle.Fill; - this.pbPreview.DrawCheckeredBackground = true; - this.pbPreview.Location = new System.Drawing.Point(335, 0); - this.pbPreview.Margin = new System.Windows.Forms.Padding(0); - this.pbPreview.Name = "pbPreview"; - this.pbPreview.PictureBoxBackColor = System.Drawing.SystemColors.Window; - this.pbPreview.Size = new System.Drawing.Size(1049, 761); - this.pbPreview.TabIndex = 12; - // // ImageBeautifierForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -269,6 +336,7 @@ private void InitializeComponent() this.Controls.Add(this.tlpMain); this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.MinimumSize = new System.Drawing.Size(1000, 600); this.Name = "ImageBeautifierForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -305,5 +373,10 @@ private void InitializeComponent() private System.Windows.Forms.Panel pOptions; private HelpersLib.MyPictureBox pbPreview; private System.Windows.Forms.PictureBox pbBackground; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.Button btnUpload; + private System.Windows.Forms.Button btnSaveAs; + private System.Windows.Forms.Button btnCopy; + private System.Windows.Forms.Button btnPrint; } } \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs index 56a045e9e..551786926 100644 --- a/ShareX.MediaLib/Forms/ImageBeautifierForm.cs +++ b/ShareX.MediaLib/Forms/ImageBeautifierForm.cs @@ -36,12 +36,12 @@ public partial class ImageBeautifierForm : Form public Bitmap SourceImage { get; private set; } public Bitmap PreviewImage { get; private set; } public ImageBeautifierOptions Options { get; private set; } + public string FilePath { get; private set; } private bool isReady, isBusy, isPending; - public ImageBeautifierForm(Bitmap sourceImage, ImageBeautifierOptions options = null) + private ImageBeautifierForm(ImageBeautifierOptions options = null) { - SourceImage = sourceImage; Options = options; if (Options == null) @@ -63,6 +63,17 @@ public ImageBeautifierForm(Bitmap sourceImage, ImageBeautifierOptions options = 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(); @@ -190,6 +201,45 @@ private async void tbRoundedCorner_Scroll(object sender, EventArgs e) await UpdatePreview(); } + private void btnCopy_Click(object sender, EventArgs e) + { + if (PreviewImage != null) + { + ClipboardHelpers.CopyImage(PreviewImage); + } + } + + private void btnSave_Click(object sender, EventArgs e) + { + if (PreviewImage != null && !string.IsNullOrEmpty(FilePath)) + { + ImageHelpers.SaveImage(PreviewImage, FilePath); + } + } + + private void btnSaveAs_Click(object sender, EventArgs e) + { + if (PreviewImage != null) + { + string filePath = ImageHelpers.SaveImageFileDialog(PreviewImage, FilePath); + + if (!string.IsNullOrEmpty(filePath)) + { + FilePath = filePath; + } + } + } + + private void btnUpload_Click(object sender, EventArgs e) + { + + } + + private void btnPrint_Click(object sender, EventArgs e) + { + + } + private async void tbShadowSize_Scroll(object sender, EventArgs e) { await UpdatePreview(); diff --git a/ShareX.MediaLib/Properties/Resources.Designer.cs b/ShareX.MediaLib/Properties/Resources.Designer.cs index bbfdbc062..ee2475c0d 100644 --- a/ShareX.MediaLib/Properties/Resources.Designer.cs +++ b/ShareX.MediaLib/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace ShareX.MediaLib.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -114,6 +114,36 @@ internal static string AlignmentVerticalCenter { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap disk_black { + get { + object obj = ResourceManager.GetObject("disk-black", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap disks_black { + get { + object obj = ResourceManager.GetObject("disks-black", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_copy { + get { + object obj = ResourceManager.GetObject("document-copy", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to FFmpeg error. /// @@ -141,6 +171,16 @@ internal static string LowerQualitySize { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap printer { + get { + object obj = ResourceManager.GetObject("printer", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to Start encoding. /// @@ -168,6 +208,16 @@ internal static string ThumbnailsSuccessfullyGenerated { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap upload_cloud { + get { + object obj = ResourceManager.GetObject("upload-cloud", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to Browse for media file. /// diff --git a/ShareX.MediaLib/Properties/Resources.resx b/ShareX.MediaLib/Properties/Resources.resx index bffb2a598..39e948dc3 100644 --- a/ShareX.MediaLib/Properties/Resources.resx +++ b/ShareX.MediaLib/Properties/Resources.resx @@ -1,117 +1,146 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Browse for media file + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\document-copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Thumbnails successfully generated. - - Lower quality/size + + ..\Resources\disks-black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Top + + + Stop encoding Higher quality/size - - Stop encoding + + Bottom + + + Right Start encoding @@ -119,22 +148,28 @@ FFmpeg error - - Top - - + Center - - Bottom + + ..\Resources\upload-cloud.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Browse for media file Left - + Center - - Right + + 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 \ No newline at end of file diff --git a/ShareX.MediaLib/Resources/disk-black.png b/ShareX.MediaLib/Resources/disk-black.png new file mode 100644 index 000000000..26507e51b Binary files /dev/null and b/ShareX.MediaLib/Resources/disk-black.png differ diff --git a/ShareX.MediaLib/Resources/disks-black.png b/ShareX.MediaLib/Resources/disks-black.png new file mode 100644 index 000000000..4089760ef Binary files /dev/null and b/ShareX.MediaLib/Resources/disks-black.png differ diff --git a/ShareX.MediaLib/Resources/document-copy.png b/ShareX.MediaLib/Resources/document-copy.png new file mode 100644 index 000000000..182804a48 Binary files /dev/null and b/ShareX.MediaLib/Resources/document-copy.png differ diff --git a/ShareX.MediaLib/Resources/printer.png b/ShareX.MediaLib/Resources/printer.png new file mode 100644 index 000000000..50ac1f4c2 Binary files /dev/null and b/ShareX.MediaLib/Resources/printer.png differ diff --git a/ShareX.MediaLib/Resources/upload-cloud.png b/ShareX.MediaLib/Resources/upload-cloud.png new file mode 100644 index 000000000..911345a4b Binary files /dev/null and b/ShareX.MediaLib/Resources/upload-cloud.png differ diff --git a/ShareX.MediaLib/ShareX.MediaLib.csproj b/ShareX.MediaLib/ShareX.MediaLib.csproj index 572a03c78..a8c4d9256 100644 --- a/ShareX.MediaLib/ShareX.MediaLib.csproj +++ b/ShareX.MediaLib/ShareX.MediaLib.csproj @@ -436,6 +436,21 @@ + + + + + + + + + + + + + + +