mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Use after capture tasks on annotate image result
This commit is contained in:
parent
e9ad46700b
commit
68d0ad1413
2 changed files with 32 additions and 18 deletions
|
@ -150,30 +150,38 @@ public static void ShowScreenRuler(RegionCaptureOptions options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AnnotateImage(string filePath, RegionCaptureOptions options)
|
public static Image AnnotateImage(string filePath, RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
using (Image img = ImageHelpers.LoadImage(filePath))
|
using (Image img = ImageHelpers.LoadImage(filePath))
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Editor))
|
|
||||||
{
|
{
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
return AnnotateImage(img, options);
|
||||||
form.Config.DetectWindows = false;
|
|
||||||
form.Config.ShowTips = false;
|
|
||||||
form.Config.UseDimming = false;
|
|
||||||
|
|
||||||
form.Prepare(img);
|
|
||||||
form.ShowDialog();
|
|
||||||
|
|
||||||
if (form.Result == RegionResult.Region)
|
|
||||||
{
|
|
||||||
using (Image result = form.GetResultImage())
|
|
||||||
{
|
|
||||||
ImageHelpers.SaveImage(result, filePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image AnnotateImage(Image img, RegionCaptureOptions options)
|
||||||
|
{
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Editor))
|
||||||
|
{
|
||||||
|
form.Config = GetRegionCaptureOptions(options);
|
||||||
|
form.Config.DetectWindows = false;
|
||||||
|
form.Config.ShowTips = false;
|
||||||
|
form.Config.UseDimming = false;
|
||||||
|
|
||||||
|
form.Prepare(img);
|
||||||
|
form.ShowDialog();
|
||||||
|
|
||||||
|
if (form.Result == RegionResult.Region)
|
||||||
|
{
|
||||||
|
return form.GetResultImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image ApplyRegionPathToImage(Image img, GraphicsPath gp)
|
public static Image ApplyRegionPathToImage(Image img, GraphicsPath gp)
|
||||||
|
|
|
@ -606,7 +606,13 @@ public static void OpenImageEditor(string filePath = null, TaskSettings taskSett
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filePath))
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
{
|
{
|
||||||
RegionCaptureHelpers.AnnotateImage(filePath, taskSettings.CaptureSettingsReference.SurfaceOptions);
|
Image img = RegionCaptureHelpers.AnnotateImage(filePath, taskSettings.CaptureSettingsReference.SurfaceOptions);
|
||||||
|
|
||||||
|
if (img != null)
|
||||||
|
{
|
||||||
|
UploadManager.RunImageTask(img, taskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
//AnnotateImage(filePath);
|
//AnnotateImage(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue