截图完成时自动设置默认边框特效

This commit is contained in:
xucongli1989 2017-01-15 12:27:18 +08:00
commit ebd9b70a43
12 changed files with 33 additions and 9 deletions

View file

@ -65,6 +65,7 @@ namespace Greenshot.Destinations {
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
try {
base.SetDefaults(surface);
ClipboardHelper.SetClipboardData(surface);
exportInformation.ExportMade = true;
} catch (Exception) {

View file

@ -85,7 +85,8 @@ namespace Greenshot.Destinations {
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
// Make sure we collect the garbage before opening the screenshot
GC.Collect();
GC.WaitForPendingFinalizers();

View file

@ -50,7 +50,8 @@ namespace Greenshot.Destinations {
public override Image DisplayIcon => GreenshotResources.getImage("Save.Image");
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
bool outputMade;
bool overwrite;
string fullPath;

View file

@ -70,7 +70,8 @@ namespace Greenshot.Destinations {
// Bug #2918756 don't overwrite path if SaveWithDialog returns null!
var savedTo = ImageOutput.SaveWithDialog(surface, captureDetails);
if (savedTo != null) {
exportInformation.ExportMade = true;
base.SetDefaults(surface);
exportInformation.ExportMade = true;
exportInformation.Filepath = savedTo;
captureDetails.Filename = savedTo;
conf.OutputFileAsFullpath = savedTo;

View file

@ -47,6 +47,7 @@ namespace Greenshot.Destinations {
/// <param name="captureDetails">Details of the capture</param>
/// <returns>true if export was made</returns>
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
base.SetDefaults(surface);
List<IDestination> destinations = new List<IDestination>();
foreach(IDestination destination in DestinationHelper.GetAllDestinations()) {
if ("Picker".Equals(destination.Designation)) {

View file

@ -116,7 +116,8 @@ namespace Greenshot.Destinations {
/// <param name="captureDetails"></param>
/// <returns>ExportInformation</returns>
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
PrinterSettings printerSettings;
if (!string.IsNullOrEmpty(printerName)) {
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) {

View file

@ -72,7 +72,8 @@ namespace GreenshotOfficePlugin {
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
bool createdFile = false;
string imageFile = captureDetails.Filename;
if (imageFile == null || surface.Modified || !Regex.IsMatch(imageFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) {

View file

@ -99,7 +99,8 @@ namespace GreenshotOfficePlugin {
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
if (page == null) {
try {

View file

@ -113,7 +113,8 @@ namespace GreenshotOfficePlugin {
/// <param name="captureDetails"></param>
/// <returns></returns>
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
// Outlook logic
string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) {

View file

@ -89,7 +89,8 @@ namespace GreenshotOfficePlugin {
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
string tmpFile = captureDetails.Filename;
Size imageSize = Size.Empty;
if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) {

View file

@ -73,7 +73,8 @@ namespace GreenshotOfficePlugin {
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
base.SetDefaults(surface);
ExportInformation exportInformation = new ExportInformation(Designation, Description);
string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) {
tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat());

View file

@ -89,6 +89,19 @@ namespace GreenshotPlugin.Core {
}
}
/// <summary>
/// set defaults infomation when export capture.
/// </summary>
public virtual void SetDefaults(ISurface surface)
{
if (null == surface)
{
return;
}
//set default border effect.
surface.ApplyBitmapEffect(new Effects.BorderEffect());
}
public abstract ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
/// <summary>