mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Fixes for refactoring the save method (added boolean for reduce colors)
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1710 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
221a92ee55
commit
bae0b6c34a
8 changed files with 16 additions and 9 deletions
|
@ -163,10 +163,10 @@ namespace GreenshotOCR {
|
|||
graphics.Clear(Color.White);
|
||||
graphics.DrawImage(capturedImage, Point.Empty);
|
||||
}
|
||||
filePath = host.SaveToTmpFile(tmpImage, OutputFormat.bmp, 100);
|
||||
filePath = host.SaveToTmpFile(tmpImage, OutputFormat.bmp, 100, false);
|
||||
}
|
||||
} else {
|
||||
filePath = host.SaveToTmpFile(capturedImage, OutputFormat.bmp, 100);
|
||||
filePath = host.SaveToTmpFile(capturedImage, OutputFormat.bmp, 100, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -403,8 +403,8 @@ namespace Greenshot {
|
|||
} catch {}
|
||||
break;
|
||||
case CommandEnum.OpenFile:
|
||||
LOG.InfoFormat("Open file requested: {0}", filename);
|
||||
string filename = command.Value;
|
||||
LOG.InfoFormat("Open file requested: {0}", filename);
|
||||
if (File.Exists(filename)) {
|
||||
BeginInvoke((MethodInvoker)delegate {
|
||||
CaptureHelper.CaptureFile(filename);
|
||||
|
|
|
@ -54,6 +54,11 @@ namespace GreenshotConfluencePlugin {
|
|||
get;
|
||||
set;
|
||||
}
|
||||
[IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")]
|
||||
public bool UploadReduceColors {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
[IniProperty("OpenPageAfterUpload", Description="Open the page where the picture is uploaded after upload", DefaultValue="True")]
|
||||
public bool OpenPageAfterUpload {
|
||||
get;
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace GreenshotConfluencePlugin {
|
|||
private bool upload(Image image, Page page, string filename, bool openPage) {
|
||||
byte[] buffer;
|
||||
using (MemoryStream stream = new MemoryStream()) {
|
||||
ConfluencePlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality);
|
||||
ConfluencePlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
// COPY buffer to array
|
||||
buffer = stream.ToArray();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace ExternalCommand {
|
|||
string fullPath = captureDetails.Filename;
|
||||
if (fullPath == null) {
|
||||
using (Image image = surface.GetImageForExport()) {
|
||||
fullPath = host.SaveNamedTmpFile(image, captureDetails, OutputFormat.png, 100);
|
||||
fullPath = host.SaveNamedTmpFile(image, captureDetails, OutputFormat.png, 100, false);
|
||||
}
|
||||
}
|
||||
if (presetCommand != null) {
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace GreenshotImgurPlugin {
|
|||
public OutputFormat UploadFormat;
|
||||
[IniProperty("UploadJpegQuality", Description="JPEG file save quality in %.", DefaultValue="80")]
|
||||
public int UploadJpegQuality;
|
||||
[IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")]
|
||||
public bool UploadReduceColors;
|
||||
[IniProperty("UsePageLink", Description = "Use pagelink instead of direct link on the clipboard", DefaultValue = "False")]
|
||||
public bool UsePageLink;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace GreenshotImgurPlugin {
|
|||
using (MemoryStream stream = new MemoryStream()) {
|
||||
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, lang.GetString(LangKey.communication_wait));
|
||||
|
||||
host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality);
|
||||
host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
try {
|
||||
string filename = Path.GetFileName(host.GetFilename(config.UploadFormat, captureDetails));
|
||||
ImgurInfo imgurInfo = ImgurUtils.UploadToImgur(stream.GetBuffer(), (int)stream.Length, captureDetails.DateTime.ToString(), filename);
|
||||
|
@ -178,7 +178,7 @@ namespace GreenshotImgurPlugin {
|
|||
using (MemoryStream stream = new MemoryStream()) {
|
||||
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, lang.GetString(LangKey.communication_wait));
|
||||
|
||||
imageEditor.SaveToStream(stream, config.UploadFormat, config.UploadJpegQuality);
|
||||
imageEditor.SaveToStream(stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
try {
|
||||
string filename = Path.GetFileName(host.GetFilename(config.UploadFormat, imageEditor.CaptureDetails));
|
||||
ImgurInfo imgurInfo = ImgurUtils.UploadToImgur(stream.GetBuffer(), (int)stream.Length, imageEditor.CaptureDetails.Title, filename);
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace GreenshotJiraPlugin {
|
|||
if (jira != null) {
|
||||
using (MemoryStream stream = new MemoryStream()) {
|
||||
using (Image image = surface.GetImageForExport()) {
|
||||
jiraPlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality);
|
||||
jiraPlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
}
|
||||
// COPY stream to buffer
|
||||
buffer = stream.ToArray();
|
||||
|
@ -132,7 +132,7 @@ namespace GreenshotJiraPlugin {
|
|||
if (result == DialogResult.OK) {
|
||||
using (MemoryStream stream = new MemoryStream()) {
|
||||
using (Image image = surface.GetImageForExport()) {
|
||||
jiraPlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality);
|
||||
jiraPlugin.Host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
}
|
||||
// COPY stream to buffer
|
||||
buffer = stream.ToArray();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue