mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 11:10:23 +12:00
ImageBeautifierForm improvements
This commit is contained in:
parent
2ec6429270
commit
34fcbc6fb1
|
@ -38,6 +38,9 @@ public partial class ImageBeautifierForm : Form
|
|||
public ImageBeautifierOptions Options { get; private set; }
|
||||
public string FilePath { get; private set; }
|
||||
|
||||
public event Action<Bitmap> UploadImageRequested;
|
||||
public event Action<Bitmap> PrintImageRequested;
|
||||
|
||||
private bool isReady, isBusy, isPending;
|
||||
|
||||
private ImageBeautifierForm(ImageBeautifierOptions options = null)
|
||||
|
@ -176,6 +179,16 @@ private void UpdateOptions()
|
|||
Options.ShadowSize = tbShadowSize.Value;
|
||||
}
|
||||
|
||||
private void OnUploadImageRequested()
|
||||
{
|
||||
UploadImageRequested?.Invoke(PreviewImage);
|
||||
}
|
||||
|
||||
private void OnPrintImageRequested()
|
||||
{
|
||||
PrintImageRequested?.Invoke(PreviewImage);
|
||||
}
|
||||
|
||||
private async void ImageBeautifierForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
await UpdatePreview();
|
||||
|
@ -232,12 +245,18 @@ private void btnSaveAs_Click(object sender, EventArgs e)
|
|||
|
||||
private void btnUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (PreviewImage != null)
|
||||
{
|
||||
OnUploadImageRequested();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (PreviewImage != null)
|
||||
{
|
||||
OnPrintImageRequested();
|
||||
}
|
||||
}
|
||||
|
||||
private async void tbShadowSize_Scroll(object sender, EventArgs e)
|
||||
|
|
|
@ -1037,7 +1037,10 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
using (output) { PrintImage(output); }
|
||||
using (output)
|
||||
{
|
||||
PrintImage(output);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1062,13 +1065,29 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void OpenImageBeautifier()
|
||||
public static void OpenImageBeautifier(TaskSettings taskSettings = null)
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
||||
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(filePath, new ImageBeautifierOptions());
|
||||
|
||||
imageBeautifierForm.UploadImageRequested += output =>
|
||||
{
|
||||
UploadManager.UploadImage(output, taskSettings);
|
||||
};
|
||||
|
||||
imageBeautifierForm.PrintImageRequested += output =>
|
||||
{
|
||||
using (output)
|
||||
{
|
||||
PrintImage(output);
|
||||
}
|
||||
};
|
||||
|
||||
imageBeautifierForm.Show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue