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;
|
Image img;
|
||||||
|
|
||||||
if (Settings.AutoRotateImage && ((rect.Width > rect.Height && Image.Width < Image.Height) ||
|
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 = (Image)Image.Clone();
|
||||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||||
|
|
|
@ -241,12 +241,12 @@ private void UpdateOptions()
|
||||||
|
|
||||||
private void OnUploadImageRequested()
|
private void OnUploadImageRequested()
|
||||||
{
|
{
|
||||||
UploadImageRequested?.Invoke(PreviewImage);
|
UploadImageRequested?.Invoke(PreviewImage.CloneSafe());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPrintImageRequested()
|
private void OnPrintImageRequested()
|
||||||
{
|
{
|
||||||
PrintImageRequested?.Invoke(PreviewImage);
|
PrintImageRequested?.Invoke(PreviewImage.CloneSafe());
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ImageBeautifierForm_Shown(object sender, EventArgs e)
|
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)
|
if (pbQRCode.Image != null)
|
||||||
{
|
{
|
||||||
Bitmap bmp = (Bitmap)pbQRCode.Image.Clone();
|
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;
|
return newFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
form.CopyImageRequested += output =>
|
form.CopyImageRequested += MainFormCopyImage;
|
||||||
{
|
form.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||||
Program.MainForm.InvokeSafe(() =>
|
form.PrintImageRequested += MainFormPrintImage;
|
||||||
{
|
|
||||||
ClipboardHelpers.CopyImage(output);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
form.UploadImageRequested += output =>
|
|
||||||
{
|
|
||||||
Program.MainForm.InvokeSafe(() =>
|
|
||||||
{
|
|
||||||
UploadManager.UploadImage(output, taskSettings);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
form.PrintImageRequested += output =>
|
|
||||||
{
|
|
||||||
Program.MainForm.InvokeSafe(() =>
|
|
||||||
{
|
|
||||||
using (output)
|
|
||||||
{
|
|
||||||
PrintImage(output);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
switch (form.Result)
|
switch (form.Result)
|
||||||
|
@ -1088,6 +1064,33 @@ public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings tas
|
||||||
return null;
|
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)
|
public static void OpenImageBeautifier(TaskSettings taskSettings = null)
|
||||||
{
|
{
|
||||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
string filePath = ImageHelpers.OpenImageFileDialog();
|
||||||
|
@ -1102,20 +1105,8 @@ public static void OpenImageBeautifier(string filePath, TaskSettings taskSetting
|
||||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||||
|
|
||||||
ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(filePath, taskSettings.ToolsSettingsReference.ImageBeautifierOptions);
|
ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(filePath, taskSettings.ToolsSettingsReference.ImageBeautifierOptions);
|
||||||
|
imageBeautifierForm.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||||
imageBeautifierForm.UploadImageRequested += output =>
|
imageBeautifierForm.PrintImageRequested += MainFormPrintImage;
|
||||||
{
|
|
||||||
UploadManager.UploadImage(output, taskSettings);
|
|
||||||
};
|
|
||||||
|
|
||||||
imageBeautifierForm.PrintImageRequested += output =>
|
|
||||||
{
|
|
||||||
using (output)
|
|
||||||
{
|
|
||||||
PrintImage(output);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
imageBeautifierForm.Show();
|
imageBeautifierForm.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1128,19 +1119,8 @@ public static Bitmap BeautifyImage(Bitmap bmp, TaskSettings taskSettings = null)
|
||||||
|
|
||||||
using (ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(bmp, taskSettings.ToolsSettingsReference.ImageBeautifierOptions))
|
using (ImageBeautifierForm imageBeautifierForm = new ImageBeautifierForm(bmp, taskSettings.ToolsSettingsReference.ImageBeautifierOptions))
|
||||||
{
|
{
|
||||||
imageBeautifierForm.UploadImageRequested += output =>
|
imageBeautifierForm.UploadImageRequested += output => MainFormUploadImage(output, taskSettings);
|
||||||
{
|
imageBeautifierForm.PrintImageRequested += MainFormPrintImage;
|
||||||
UploadManager.UploadImage(output, taskSettings);
|
|
||||||
};
|
|
||||||
|
|
||||||
imageBeautifierForm.PrintImageRequested += output =>
|
|
||||||
{
|
|
||||||
using (output)
|
|
||||||
{
|
|
||||||
PrintImage(output);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
imageBeautifierForm.ShowDialog();
|
imageBeautifierForm.ShowDialog();
|
||||||
|
|
||||||
return (Bitmap)imageBeautifierForm.PreviewImage.Clone();
|
return (Bitmap)imageBeautifierForm.PreviewImage.Clone();
|
||||||
|
|
Loading…
Reference in a new issue