mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 03:00:22 +12:00
Fixed Image Beautifier issues
This commit is contained in:
parent
36c38c5cc2
commit
92c290e5b1
|
@ -158,7 +158,7 @@ private void PrintImage(PrintPageEventArgs e)
|
|||
Image img;
|
||||
|
||||
if (Settings.AutoRotateImage && ((rect.Width > rect.Height && Image.Width < Image.Height) ||
|
||||
(rect.Width < rect.Height && Image.Width > Image.Height)))
|
||||
(rect.Width < rect.Height && Image.Width > Image.Height)))
|
||||
{
|
||||
img = (Image)Image.Clone();
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
|
|
|
@ -241,12 +241,12 @@ private void UpdateOptions()
|
|||
|
||||
private void OnUploadImageRequested()
|
||||
{
|
||||
UploadImageRequested?.Invoke(PreviewImage);
|
||||
UploadImageRequested?.Invoke(PreviewImage.CloneSafe());
|
||||
}
|
||||
|
||||
private void OnPrintImageRequested()
|
||||
{
|
||||
PrintImageRequested?.Invoke(PreviewImage);
|
||||
PrintImageRequested?.Invoke(PreviewImage.CloneSafe());
|
||||
}
|
||||
|
||||
private async void ImageBeautifierForm_Shown(object sender, EventArgs e)
|
||||
|
|
|
@ -286,7 +286,7 @@ private void btnUploadImage_Click(object sender, EventArgs e)
|
|||
if (pbQRCode.Image != null)
|
||||
{
|
||||
Bitmap bmp = (Bitmap)pbQRCode.Image.Clone();
|
||||
UploadManager.UploadImage(bmp);
|
||||
TaskHelpers.MainFormUploadImage(bmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1040,33 +1040,9 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
return newFilePath;
|
||||
};
|
||||
|
||||
form.CopyImageRequested += output =>
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
ClipboardHelpers.CopyImage(output);
|
||||
});
|
||||
};
|
||||
|
||||
form.UploadImageRequested += output =>
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
UploadManager.UploadImage(output, taskSettings);
|
||||
});
|
||||
};
|
||||
|
||||
form.PrintImageRequested += output =>
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
using (output)
|
||||
{
|
||||
PrintImage(output);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
form.CopyImageRequested += MainFormCopyImage;
|
||||
form.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||
form.PrintImageRequested += MainFormPrintImage;
|
||||
form.ShowDialog();
|
||||
|
||||
switch (form.Result)
|
||||
|
@ -1088,6 +1064,33 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void MainFormCopyImage(Bitmap bmp)
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
ClipboardHelpers.CopyImage(bmp);
|
||||
});
|
||||
}
|
||||
|
||||
public static void MainFormUploadImage(Bitmap bmp, TaskSettings taskSettings = null)
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
UploadManager.UploadImage(bmp, taskSettings);
|
||||
});
|
||||
}
|
||||
|
||||
public static void MainFormPrintImage(Bitmap bmp)
|
||||
{
|
||||
Program.MainForm.InvokeSafe(() =>
|
||||
{
|
||||
using (bmp)
|
||||
{
|
||||
PrintImage(bmp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void OpenImageBeautifier(TaskSettings taskSettings = null)
|
||||
{
|
||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
||||
|
@ -1102,20 +1105,8 @@ public static void OpenImageBeautifier(string filePath, TaskSettings taskSetting
|
|||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(filePath, taskSettings.ToolsSettingsReference.ImageBeautifierOptions);
|
||||
|
||||
imageBeautifierForm.UploadImageRequested += output =>
|
||||
{
|
||||
UploadManager.UploadImage(output, taskSettings);
|
||||
};
|
||||
|
||||
imageBeautifierForm.PrintImageRequested += output =>
|
||||
{
|
||||
using (output)
|
||||
{
|
||||
PrintImage(output);
|
||||
}
|
||||
};
|
||||
|
||||
imageBeautifierForm.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||
imageBeautifierForm.PrintImageRequested += MainFormPrintImage;
|
||||
imageBeautifierForm.Show();
|
||||
}
|
||||
}
|
||||
|
@ -1128,19 +1119,8 @@ public static Bitmap BeautifyImage(Bitmap bmp, TaskSettings taskSettings = null)
|
|||
|
||||
using (ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(bmp, taskSettings.ToolsSettingsReference.ImageBeautifierOptions))
|
||||
{
|
||||
imageBeautifierForm.UploadImageRequested += output =>
|
||||
{
|
||||
UploadManager.UploadImage(output, taskSettings);
|
||||
};
|
||||
|
||||
imageBeautifierForm.PrintImageRequested += output =>
|
||||
{
|
||||
using (output)
|
||||
{
|
||||
PrintImage(output);
|
||||
}
|
||||
};
|
||||
|
||||
imageBeautifierForm.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||
imageBeautifierForm.PrintImageRequested += MainFormPrintImage;
|
||||
imageBeautifierForm.ShowDialog();
|
||||
|
||||
return (Bitmap)imageBeautifierForm.PreviewImage.Clone();
|
||||
|
|
Loading…
Reference in a new issue