added monochrome print option

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2491 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
JKlingen 2013-02-17 07:58:58 +00:00
parent 9f86db6828
commit b537ae7e14
11 changed files with 1612 additions and 1480 deletions

View file

@ -168,6 +168,7 @@ namespace Greenshot.Configuration {
printoptions_allowrotate,
printoptions_allowshrink,
printoptions_dontaskagain,
printoptions_printmonochrome,
printoptions_timestamp,
printoptions_inverted,
printoptions_title,

View file

@ -108,41 +108,17 @@ namespace Greenshot.Destinations {
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
PrinterSettings printerSettings = null;
// Create the output settins
SurfaceOutputSettings printOutputSettings = new SurfaceOutputSettings(OutputFormat.png, 100, false);
// TODO:
// add effects here, e.g. Monochrome
// printOutputSettings.Effects.Add(new MonochromeEffect());
// Set the color reducing if needed, this should change the 24/32-> 8 (or later even 1) bpp
// printOutputSettings.ReduceColors = true;
// Moved this from the PrintHelper, the invert effect should probably be the last!
if (conf.OutputPrintInverted) {
printOutputSettings.Effects.Add(new InvertEffect());
}
Image imageToPrint;
Boolean disposeImage = ImageOutput.CreateImageFromSurface(surface, printOutputSettings, out imageToPrint);
try {
if (!string.IsNullOrEmpty(printerName)) {
printerSettings = new PrintHelper(imageToPrint, captureDetails).PrintTo(printerName);
printerSettings = new PrintHelper(surface, captureDetails).PrintTo(printerName);
} else if (!manuallyInitiated) {
PrinterSettings settings = new PrinterSettings();
printerSettings = new PrintHelper(imageToPrint, captureDetails).PrintTo(settings.PrinterName);
printerSettings = new PrintHelper(surface, captureDetails).PrintTo(settings.PrinterName);
} else {
printerSettings = new PrintHelper(imageToPrint, captureDetails).PrintWithDialog();
printerSettings = new PrintHelper(surface, captureDetails).PrintWithDialog();
}
if (printerSettings != null) {
exportInformation.ExportMade = true;
}
} finally {
if (disposeImage && imageToPrint != null) {
imageToPrint.Dispose();
imageToPrint = null;
}
}
ProcessExport(exportInformation, surface);
return exportInformation;

View file

@ -58,6 +58,7 @@ namespace Greenshot.Forms
this.button_cancel = new GreenshotPlugin.Controls.GreenshotButton();
this.checkboxPrintInverted = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkbox_grayscale = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkbox_monochrome = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.SuspendLayout();
//
// checkbox_dontaskagain
@ -66,7 +67,7 @@ namespace Greenshot.Forms
this.checkbox_dontaskagain.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.LanguageKey = "printoptions_dontaskagain";
this.checkbox_dontaskagain.Location = new System.Drawing.Point(12, 191);
this.checkbox_dontaskagain.Location = new System.Drawing.Point(12, 214);
this.checkbox_dontaskagain.Name = "checkbox_dontaskagain";
this.checkbox_dontaskagain.Size = new System.Drawing.Size(240, 17);
this.checkbox_dontaskagain.TabIndex = 19;
@ -139,11 +140,11 @@ namespace Greenshot.Forms
this.button_ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button_ok.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button_ok.LanguageKey = "OK";
this.button_ok.Location = new System.Drawing.Point(187, 224);
this.button_ok.Location = new System.Drawing.Point(187, 267);
this.button_ok.Name = "button_ok";
this.button_ok.Size = new System.Drawing.Size(75, 23);
this.button_ok.TabIndex = 25;
this.button_ok.Text = "OK";
this.button_ok.Text = "Ok";
this.button_ok.UseVisualStyleBackColor = true;
this.button_ok.Click += new System.EventHandler(this.Button_okClick);
//
@ -167,7 +168,7 @@ namespace Greenshot.Forms
this.button_cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button_cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button_cancel.LanguageKey = "CANCEL";
this.button_cancel.Location = new System.Drawing.Point(268, 224);
this.button_cancel.Location = new System.Drawing.Point(268, 267);
this.button_cancel.Name = "button_cancel";
this.button_cancel.Size = new System.Drawing.Size(75, 23);
this.button_cancel.TabIndex = 27;
@ -204,11 +205,27 @@ namespace Greenshot.Forms
this.checkbox_grayscale.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_grayscale.UseVisualStyleBackColor = true;
//
// checkbox_monochrome
//
this.checkbox_monochrome.AutoSize = true;
this.checkbox_monochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.LanguageKey = "printoptions_printmonochrome";
this.checkbox_monochrome.Location = new System.Drawing.Point(12, 181);
this.checkbox_monochrome.Name = "checkbox_monochrome";
this.checkbox_monochrome.PropertyName = "OutputPrintMonochrome";
this.checkbox_monochrome.Size = new System.Drawing.Size(149, 17);
this.checkbox_monochrome.TabIndex = 30;
this.checkbox_monochrome.Text = "Force black/white printing";
this.checkbox_monochrome.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.UseVisualStyleBackColor = true;
//
// PrintOptionsDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(355, 259);
this.ClientSize = new System.Drawing.Size(355, 302);
this.Controls.Add(this.checkbox_monochrome);
this.Controls.Add(this.checkbox_grayscale);
this.Controls.Add(this.checkboxPrintInverted);
this.Controls.Add(this.button_cancel);
@ -227,6 +244,7 @@ namespace Greenshot.Forms
this.Text = "Greenshot print options";
this.ResumeLayout(false);
this.PerformLayout();
}
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_grayscale;
private GreenshotPlugin.Controls.GreenshotCheckBox checkboxPrintInverted;
@ -238,5 +256,6 @@ namespace Greenshot.Forms
private GreenshotPlugin.Controls.GreenshotCheckBox checkboxAllowEnlarge;
private GreenshotPlugin.Controls.GreenshotCheckBox checkboxAllowShrink;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_dontaskagain;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_monochrome;
}
}

View file

@ -73,7 +73,7 @@ namespace Greenshot {
this.groupbox_destination = new GreenshotPlugin.Controls.GreenshotGroupBox();
this.checkbox_picker = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.listview_destinations = new System.Windows.Forms.ListView();
this.destination = new System.Windows.Forms.ColumnHeader();
this.destination = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tabcontrol = new System.Windows.Forms.TabControl();
this.tab_general = new GreenshotPlugin.Controls.GreenshotTabPage();
this.groupbox_network = new GreenshotPlugin.Controls.GreenshotGroupBox();
@ -111,6 +111,7 @@ namespace Greenshot {
this.tab_destinations = new GreenshotPlugin.Controls.GreenshotTabPage();
this.tab_printer = new GreenshotPlugin.Controls.GreenshotTabPage();
this.groupbox_printoptions = new GreenshotPlugin.Controls.GreenshotGroupBox();
this.checkbox_monochrome = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkbox_printgrayscale = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkboxPrintInverted = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkbox_alwaysshowprintoptionsdialog = new GreenshotPlugin.Controls.GreenshotCheckBox();
@ -139,7 +140,7 @@ namespace Greenshot {
this.label_clipboardformats = new GreenshotPlugin.Controls.GreenshotLabel();
this.checkbox_enableexpert = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.listview_clipboardformats = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupbox_preferredfilesettings.SuspendLayout();
this.groupbox_applicationsettings.SuspendLayout();
this.groupbox_qualitysettings.SuspendLayout();
@ -181,6 +182,7 @@ namespace Greenshot {
this.label_storagelocation.Name = "label_storagelocation";
this.label_storagelocation.Size = new System.Drawing.Size(126, 23);
this.label_storagelocation.TabIndex = 11;
this.label_storagelocation.Text = "Storage location";
//
// settings_cancel
//
@ -189,6 +191,7 @@ namespace Greenshot {
this.settings_cancel.Name = "settings_cancel";
this.settings_cancel.Size = new System.Drawing.Size(75, 23);
this.settings_cancel.TabIndex = 7;
this.settings_cancel.Text = "Cancel";
this.settings_cancel.UseVisualStyleBackColor = true;
this.settings_cancel.Click += new System.EventHandler(this.Settings_cancelClick);
//
@ -199,6 +202,7 @@ namespace Greenshot {
this.settings_confirm.Name = "settings_confirm";
this.settings_confirm.Size = new System.Drawing.Size(75, 23);
this.settings_confirm.TabIndex = 6;
this.settings_confirm.Text = "Ok";
this.settings_confirm.UseVisualStyleBackColor = true;
this.settings_confirm.Click += new System.EventHandler(this.Settings_okayClick);
//
@ -219,6 +223,7 @@ namespace Greenshot {
this.label_screenshotname.Name = "label_screenshotname";
this.label_screenshotname.Size = new System.Drawing.Size(126, 23);
this.label_screenshotname.TabIndex = 9;
this.label_screenshotname.Text = "Filename pattern";
//
// textbox_screenshotname
//
@ -235,6 +240,7 @@ namespace Greenshot {
this.label_language.Name = "label_language";
this.label_language.Size = new System.Drawing.Size(181, 23);
this.label_language.TabIndex = 10;
this.label_language.Text = "Language";
//
// combobox_language
//
@ -263,6 +269,7 @@ namespace Greenshot {
this.label_primaryimageformat.Name = "label_primaryimageformat";
this.label_primaryimageformat.Size = new System.Drawing.Size(126, 19);
this.label_primaryimageformat.TabIndex = 8;
this.label_primaryimageformat.Text = "Image format";
//
// groupbox_preferredfilesettings
//
@ -281,6 +288,7 @@ namespace Greenshot {
this.groupbox_preferredfilesettings.Size = new System.Drawing.Size(412, 122);
this.groupbox_preferredfilesettings.TabIndex = 13;
this.groupbox_preferredfilesettings.TabStop = false;
this.groupbox_preferredfilesettings.Text = "Preferred Output File Settings";
//
// btnPatternHelp
//
@ -300,6 +308,7 @@ namespace Greenshot {
this.checkbox_copypathtoclipboard.PropertyName = "OutputFileCopyPathToClipboard";
this.checkbox_copypathtoclipboard.Size = new System.Drawing.Size(394, 24);
this.checkbox_copypathtoclipboard.TabIndex = 18;
this.checkbox_copypathtoclipboard.Text = "Copy file path to clipboard every time an image is saved";
this.checkbox_copypathtoclipboard.UseVisualStyleBackColor = true;
//
// groupbox_applicationsettings
@ -313,6 +322,7 @@ namespace Greenshot {
this.groupbox_applicationsettings.Size = new System.Drawing.Size(412, 68);
this.groupbox_applicationsettings.TabIndex = 14;
this.groupbox_applicationsettings.TabStop = false;
this.groupbox_applicationsettings.Text = "Application Settings";
//
// checkbox_autostartshortcut
//
@ -321,6 +331,7 @@ namespace Greenshot {
this.checkbox_autostartshortcut.Name = "checkbox_autostartshortcut";
this.checkbox_autostartshortcut.Size = new System.Drawing.Size(397, 25);
this.checkbox_autostartshortcut.TabIndex = 15;
this.checkbox_autostartshortcut.Text = "Launch Greenshot on startup";
this.checkbox_autostartshortcut.UseVisualStyleBackColor = true;
//
// groupbox_qualitysettings
@ -336,6 +347,7 @@ namespace Greenshot {
this.groupbox_qualitysettings.Size = new System.Drawing.Size(412, 106);
this.groupbox_qualitysettings.TabIndex = 14;
this.groupbox_qualitysettings.TabStop = false;
this.groupbox_qualitysettings.Text = "Quality settings";
//
// checkbox_reducecolors
//
@ -345,6 +357,7 @@ namespace Greenshot {
this.checkbox_reducecolors.PropertyName = "OutputFileReduceColors";
this.checkbox_reducecolors.Size = new System.Drawing.Size(394, 25);
this.checkbox_reducecolors.TabIndex = 17;
this.checkbox_reducecolors.Text = "Reduce the amount of colors to a maximum of 256";
this.checkbox_reducecolors.UseVisualStyleBackColor = true;
//
// checkbox_alwaysshowqualitydialog
@ -355,6 +368,7 @@ namespace Greenshot {
this.checkbox_alwaysshowqualitydialog.PropertyName = "OutputFilePromptQuality";
this.checkbox_alwaysshowqualitydialog.Size = new System.Drawing.Size(394, 25);
this.checkbox_alwaysshowqualitydialog.TabIndex = 16;
this.checkbox_alwaysshowqualitydialog.Text = "Show quality dialog every time an image is saved";
this.checkbox_alwaysshowqualitydialog.UseVisualStyleBackColor = true;
//
// label_jpegquality
@ -364,6 +378,7 @@ namespace Greenshot {
this.label_jpegquality.Name = "label_jpegquality";
this.label_jpegquality.Size = new System.Drawing.Size(116, 23);
this.label_jpegquality.TabIndex = 13;
this.label_jpegquality.Text = "JPEG quality";
//
// textBoxJpegQuality
//
@ -395,6 +410,7 @@ namespace Greenshot {
this.groupbox_destination.Size = new System.Drawing.Size(412, 311);
this.groupbox_destination.TabIndex = 16;
this.groupbox_destination.TabStop = false;
this.groupbox_destination.Text = "Destination";
//
// checkbox_picker
//
@ -403,6 +419,7 @@ namespace Greenshot {
this.checkbox_picker.Name = "checkbox_picker";
this.checkbox_picker.Size = new System.Drawing.Size(394, 24);
this.checkbox_picker.TabIndex = 19;
this.checkbox_picker.Text = "Select destination dynamically";
this.checkbox_picker.UseVisualStyleBackColor = true;
this.checkbox_picker.CheckStateChanged += new System.EventHandler(this.DestinationsCheckStateChanged);
//
@ -456,6 +473,7 @@ namespace Greenshot {
this.tab_general.Padding = new System.Windows.Forms.Padding(3);
this.tab_general.Size = new System.Drawing.Size(423, 320);
this.tab_general.TabIndex = 0;
this.tab_general.Text = "General";
this.tab_general.UseVisualStyleBackColor = true;
//
// groupbox_network
@ -469,6 +487,7 @@ namespace Greenshot {
this.groupbox_network.Size = new System.Drawing.Size(412, 72);
this.groupbox_network.TabIndex = 54;
this.groupbox_network.TabStop = false;
this.groupbox_network.Text = "Network and updates";
//
// numericUpDown_daysbetweencheck
//
@ -485,6 +504,7 @@ namespace Greenshot {
this.label_checkperiod.Name = "label_checkperiod";
this.label_checkperiod.Size = new System.Drawing.Size(334, 23);
this.label_checkperiod.TabIndex = 19;
this.label_checkperiod.Text = "Update check interval in days (0=no check)";
//
// checkbox_usedefaultproxy
//
@ -494,6 +514,7 @@ namespace Greenshot {
this.checkbox_usedefaultproxy.PropertyName = "UseProxy";
this.checkbox_usedefaultproxy.Size = new System.Drawing.Size(397, 25);
this.checkbox_usedefaultproxy.TabIndex = 17;
this.checkbox_usedefaultproxy.Text = "Use default system proxy";
this.checkbox_usedefaultproxy.UseVisualStyleBackColor = true;
//
// groupbox_hotkeys
@ -514,6 +535,7 @@ namespace Greenshot {
this.groupbox_hotkeys.Size = new System.Drawing.Size(412, 152);
this.groupbox_hotkeys.TabIndex = 15;
this.groupbox_hotkeys.TabStop = false;
this.groupbox_hotkeys.Text = "Hotkeys";
//
// label_lastregion_hotkey
//
@ -522,6 +544,7 @@ namespace Greenshot {
this.label_lastregion_hotkey.Name = "label_lastregion_hotkey";
this.label_lastregion_hotkey.Size = new System.Drawing.Size(212, 20);
this.label_lastregion_hotkey.TabIndex = 53;
this.label_lastregion_hotkey.Text = "Capture last region";
//
// lastregion_hotkeyControl
//
@ -540,6 +563,7 @@ namespace Greenshot {
this.label_ie_hotkey.Name = "label_ie_hotkey";
this.label_ie_hotkey.Size = new System.Drawing.Size(212, 20);
this.label_ie_hotkey.TabIndex = 51;
this.label_ie_hotkey.Text = "Capture Internet Explorer";
//
// ie_hotkeyControl
//
@ -558,6 +582,7 @@ namespace Greenshot {
this.label_region_hotkey.Name = "label_region_hotkey";
this.label_region_hotkey.Size = new System.Drawing.Size(212, 20);
this.label_region_hotkey.TabIndex = 49;
this.label_region_hotkey.Text = "Capture region";
//
// label_window_hotkey
//
@ -566,6 +591,7 @@ namespace Greenshot {
this.label_window_hotkey.Name = "label_window_hotkey";
this.label_window_hotkey.Size = new System.Drawing.Size(212, 23);
this.label_window_hotkey.TabIndex = 48;
this.label_window_hotkey.Text = "Capture window";
//
// label_fullscreen_hotkey
//
@ -574,6 +600,7 @@ namespace Greenshot {
this.label_fullscreen_hotkey.Name = "label_fullscreen_hotkey";
this.label_fullscreen_hotkey.Size = new System.Drawing.Size(212, 23);
this.label_fullscreen_hotkey.TabIndex = 47;
this.label_fullscreen_hotkey.Text = "Capture full screen";
//
// region_hotkeyControl
//
@ -616,6 +643,7 @@ namespace Greenshot {
this.tab_capture.Name = "tab_capture";
this.tab_capture.Size = new System.Drawing.Size(423, 320);
this.tab_capture.TabIndex = 3;
this.tab_capture.Text = "Capture";
this.tab_capture.UseVisualStyleBackColor = true;
//
// groupbox_editor
@ -627,6 +655,7 @@ namespace Greenshot {
this.groupbox_editor.Size = new System.Drawing.Size(416, 50);
this.groupbox_editor.TabIndex = 27;
this.groupbox_editor.TabStop = false;
this.groupbox_editor.Text = "Editor";
//
// checkbox_editor_match_capture_size
//
@ -637,6 +666,7 @@ namespace Greenshot {
this.checkbox_editor_match_capture_size.SectionName = "Editor";
this.checkbox_editor_match_capture_size.Size = new System.Drawing.Size(397, 24);
this.checkbox_editor_match_capture_size.TabIndex = 26;
this.checkbox_editor_match_capture_size.Text = "Match capture size";
this.checkbox_editor_match_capture_size.UseVisualStyleBackColor = true;
//
// groupbox_iecapture
@ -648,6 +678,7 @@ namespace Greenshot {
this.groupbox_iecapture.Size = new System.Drawing.Size(416, 50);
this.groupbox_iecapture.TabIndex = 2;
this.groupbox_iecapture.TabStop = false;
this.groupbox_iecapture.Text = "Internet Explorer capture";
//
// checkbox_ie_capture
//
@ -657,6 +688,7 @@ namespace Greenshot {
this.checkbox_ie_capture.PropertyName = "IECapture";
this.checkbox_ie_capture.Size = new System.Drawing.Size(404, 24);
this.checkbox_ie_capture.TabIndex = 26;
this.checkbox_ie_capture.Text = "Internet Explorer capture";
this.checkbox_ie_capture.UseVisualStyleBackColor = true;
//
// groupbox_windowscapture
@ -671,6 +703,7 @@ namespace Greenshot {
this.groupbox_windowscapture.Size = new System.Drawing.Size(416, 80);
this.groupbox_windowscapture.TabIndex = 1;
this.groupbox_windowscapture.TabStop = false;
this.groupbox_windowscapture.Text = "Window capture";
//
// colorButton_window_background
//
@ -690,6 +723,7 @@ namespace Greenshot {
this.label_window_capture_mode.Name = "label_window_capture_mode";
this.label_window_capture_mode.Size = new System.Drawing.Size(205, 23);
this.label_window_capture_mode.TabIndex = 26;
this.label_window_capture_mode.Text = "Window capture mode";
//
// checkbox_capture_windows_interactive
//
@ -699,6 +733,7 @@ namespace Greenshot {
this.checkbox_capture_windows_interactive.PropertyName = "CaptureWindowsInteractive";
this.checkbox_capture_windows_interactive.Size = new System.Drawing.Size(394, 18);
this.checkbox_capture_windows_interactive.TabIndex = 19;
this.checkbox_capture_windows_interactive.Text = "Use interactive window capture mode";
this.checkbox_capture_windows_interactive.UseVisualStyleBackColor = true;
//
// combobox_window_capture_mode
@ -725,6 +760,7 @@ namespace Greenshot {
this.groupbox_capture.Size = new System.Drawing.Size(416, 115);
this.groupbox_capture.TabIndex = 0;
this.groupbox_capture.TabStop = false;
this.groupbox_capture.Text = "Capture";
//
// checkbox_notifications
//
@ -734,6 +770,7 @@ namespace Greenshot {
this.checkbox_notifications.PropertyName = "ShowTrayNotification";
this.checkbox_notifications.Size = new System.Drawing.Size(399, 24);
this.checkbox_notifications.TabIndex = 26;
this.checkbox_notifications.Text = "Show notifications";
this.checkbox_notifications.UseVisualStyleBackColor = true;
//
// checkbox_playsound
@ -744,6 +781,7 @@ namespace Greenshot {
this.checkbox_playsound.PropertyName = "PlayCameraSound";
this.checkbox_playsound.Size = new System.Drawing.Size(399, 24);
this.checkbox_playsound.TabIndex = 18;
this.checkbox_playsound.Text = "Play camera sound";
this.checkbox_playsound.UseVisualStyleBackColor = true;
//
// checkbox_capture_mousepointer
@ -754,6 +792,7 @@ namespace Greenshot {
this.checkbox_capture_mousepointer.PropertyName = "CaptureMousepointer";
this.checkbox_capture_mousepointer.Size = new System.Drawing.Size(394, 24);
this.checkbox_capture_mousepointer.TabIndex = 17;
this.checkbox_capture_mousepointer.Text = "Capture mousepointer";
this.checkbox_capture_mousepointer.UseVisualStyleBackColor = true;
//
// numericUpDownWaitTime
@ -781,6 +820,7 @@ namespace Greenshot {
this.label_waittime.Name = "label_waittime";
this.label_waittime.Size = new System.Drawing.Size(331, 16);
this.label_waittime.TabIndex = 25;
this.label_waittime.Text = "Milliseconds to wait before capture";
//
// tab_output
//
@ -793,6 +833,7 @@ namespace Greenshot {
this.tab_output.Padding = new System.Windows.Forms.Padding(3);
this.tab_output.Size = new System.Drawing.Size(423, 320);
this.tab_output.TabIndex = 1;
this.tab_output.Text = "Output";
this.tab_output.UseVisualStyleBackColor = true;
//
// tab_destinations
@ -803,6 +844,7 @@ namespace Greenshot {
this.tab_destinations.Name = "tab_destinations";
this.tab_destinations.Size = new System.Drawing.Size(423, 320);
this.tab_destinations.TabIndex = 4;
this.tab_destinations.Text = "Destination";
this.tab_destinations.UseVisualStyleBackColor = true;
//
// tab_printer
@ -814,10 +856,12 @@ namespace Greenshot {
this.tab_printer.Padding = new System.Windows.Forms.Padding(3);
this.tab_printer.Size = new System.Drawing.Size(423, 320);
this.tab_printer.TabIndex = 2;
this.tab_printer.Text = "Printer";
this.tab_printer.UseVisualStyleBackColor = true;
//
// groupbox_printoptions
//
this.groupbox_printoptions.Controls.Add(this.checkbox_monochrome);
this.groupbox_printoptions.Controls.Add(this.checkbox_printgrayscale);
this.groupbox_printoptions.Controls.Add(this.checkboxPrintInverted);
this.groupbox_printoptions.Controls.Add(this.checkbox_alwaysshowprintoptionsdialog);
@ -829,18 +873,34 @@ namespace Greenshot {
this.groupbox_printoptions.LanguageKey = "settings_printoptions";
this.groupbox_printoptions.Location = new System.Drawing.Point(2, 6);
this.groupbox_printoptions.Name = "groupbox_printoptions";
this.groupbox_printoptions.Size = new System.Drawing.Size(412, 227);
this.groupbox_printoptions.Size = new System.Drawing.Size(412, 308);
this.groupbox_printoptions.TabIndex = 18;
this.groupbox_printoptions.TabStop = false;
this.groupbox_printoptions.Text = "Print options";
//
// checkbox_monochrome
//
this.checkbox_monochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.LanguageKey = "printoptions_printmonochrome";
this.checkbox_monochrome.Location = new System.Drawing.Point(12, 183);
this.checkbox_monochrome.Name = "checkbox_monochrome";
this.checkbox_monochrome.PropertyName = "OutputPrintMonochrome";
this.checkbox_monochrome.Size = new System.Drawing.Size(394, 20);
this.checkbox_monochrome.TabIndex = 33;
this.checkbox_monochrome.Text = "Force black/white printing";
this.checkbox_monochrome.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_monochrome.UseVisualStyleBackColor = true;
//
// checkbox_printgrayscale
//
this.checkbox_printgrayscale.LanguageKey = "printoptions_printgrayscale";
this.checkbox_printgrayscale.Location = new System.Drawing.Point(12, 167);
this.checkbox_printgrayscale.Location = new System.Drawing.Point(12, 160);
this.checkbox_printgrayscale.Name = "checkbox_printgrayscale";
this.checkbox_printgrayscale.PropertyName = "OutputPrintGrayscale";
this.checkbox_printgrayscale.Size = new System.Drawing.Size(394, 20);
this.checkbox_printgrayscale.TabIndex = 32;
this.checkbox_printgrayscale.Text = "Force grayscale printing";
this.checkbox_printgrayscale.UseVisualStyleBackColor = true;
//
// checkboxPrintInverted
@ -848,22 +908,24 @@ namespace Greenshot {
this.checkboxPrintInverted.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.LanguageKey = "printoptions_inverted";
this.checkboxPrintInverted.Location = new System.Drawing.Point(12, 144);
this.checkboxPrintInverted.Location = new System.Drawing.Point(12, 137);
this.checkboxPrintInverted.Name = "checkboxPrintInverted";
this.checkboxPrintInverted.PropertyName = "OutputPrintInverted";
this.checkboxPrintInverted.Size = new System.Drawing.Size(394, 20);
this.checkboxPrintInverted.TabIndex = 31;
this.checkboxPrintInverted.Text = "Print with inverted colors";
this.checkboxPrintInverted.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.UseVisualStyleBackColor = true;
//
// checkbox_alwaysshowprintoptionsdialog
//
this.checkbox_alwaysshowprintoptionsdialog.LanguageKey = "settings_alwaysshowprintoptionsdialog";
this.checkbox_alwaysshowprintoptionsdialog.Location = new System.Drawing.Point(12, 200);
this.checkbox_alwaysshowprintoptionsdialog.Location = new System.Drawing.Point(12, 219);
this.checkbox_alwaysshowprintoptionsdialog.Name = "checkbox_alwaysshowprintoptionsdialog";
this.checkbox_alwaysshowprintoptionsdialog.PropertyName = "OutputPrintPromptOptions";
this.checkbox_alwaysshowprintoptionsdialog.Size = new System.Drawing.Size(394, 20);
this.checkbox_alwaysshowprintoptionsdialog.TabIndex = 17;
this.checkbox_alwaysshowprintoptionsdialog.Text = "Show print options dialog every time an image is printed";
this.checkbox_alwaysshowprintoptionsdialog.UseVisualStyleBackColor = true;
//
// checkboxTimestamp
@ -871,11 +933,12 @@ namespace Greenshot {
this.checkboxTimestamp.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxTimestamp.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxTimestamp.LanguageKey = "printoptions_timestamp";
this.checkboxTimestamp.Location = new System.Drawing.Point(12, 121);
this.checkboxTimestamp.Location = new System.Drawing.Point(12, 114);
this.checkboxTimestamp.Name = "checkboxTimestamp";
this.checkboxTimestamp.PropertyName = "OutputPrintFooter";
this.checkboxTimestamp.Size = new System.Drawing.Size(394, 20);
this.checkboxTimestamp.TabIndex = 30;
this.checkboxTimestamp.Text = "Print date / time at bottom of page";
this.checkboxTimestamp.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxTimestamp.UseVisualStyleBackColor = true;
//
@ -884,11 +947,12 @@ namespace Greenshot {
this.checkboxAllowCenter.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.LanguageKey = "printoptions_allowcenter";
this.checkboxAllowCenter.Location = new System.Drawing.Point(12, 96);
this.checkboxAllowCenter.Location = new System.Drawing.Point(12, 91);
this.checkboxAllowCenter.Name = "checkboxAllowCenter";
this.checkboxAllowCenter.PropertyName = "OutputPrintCenter";
this.checkboxAllowCenter.Size = new System.Drawing.Size(394, 20);
this.checkboxAllowCenter.TabIndex = 29;
this.checkboxAllowCenter.Text = "Center printout on page";
this.checkboxAllowCenter.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.UseVisualStyleBackColor = true;
//
@ -897,11 +961,12 @@ namespace Greenshot {
this.checkboxAllowRotate.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.LanguageKey = "printoptions_allowrotate";
this.checkboxAllowRotate.Location = new System.Drawing.Point(12, 72);
this.checkboxAllowRotate.Location = new System.Drawing.Point(12, 68);
this.checkboxAllowRotate.Name = "checkboxAllowRotate";
this.checkboxAllowRotate.PropertyName = "OutputPrintAllowRotate";
this.checkboxAllowRotate.Size = new System.Drawing.Size(394, 20);
this.checkboxAllowRotate.TabIndex = 28;
this.checkboxAllowRotate.Text = "Rotate printout to page orientation";
this.checkboxAllowRotate.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.UseVisualStyleBackColor = true;
//
@ -910,11 +975,12 @@ namespace Greenshot {
this.checkboxAllowEnlarge.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.LanguageKey = "printoptions_allowenlarge";
this.checkboxAllowEnlarge.Location = new System.Drawing.Point(12, 47);
this.checkboxAllowEnlarge.Location = new System.Drawing.Point(12, 45);
this.checkboxAllowEnlarge.Name = "checkboxAllowEnlarge";
this.checkboxAllowEnlarge.PropertyName = "OutputPrintAllowEnlarge";
this.checkboxAllowEnlarge.Size = new System.Drawing.Size(394, 20);
this.checkboxAllowEnlarge.TabIndex = 27;
this.checkboxAllowEnlarge.Text = "Enlarge printout to fit paper size";
this.checkboxAllowEnlarge.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.UseVisualStyleBackColor = true;
//
@ -928,6 +994,7 @@ namespace Greenshot {
this.checkboxAllowShrink.PropertyName = "OutputPrintAllowShrink";
this.checkboxAllowShrink.Size = new System.Drawing.Size(394, 20);
this.checkboxAllowShrink.TabIndex = 26;
this.checkboxAllowShrink.Text = "Shrink printout to fit paper size";
this.checkboxAllowShrink.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.UseVisualStyleBackColor = true;
//
@ -939,6 +1006,7 @@ namespace Greenshot {
this.tab_plugins.Name = "tab_plugins";
this.tab_plugins.Size = new System.Drawing.Size(423, 320);
this.tab_plugins.TabIndex = 2;
this.tab_plugins.Text = "Plugins";
this.tab_plugins.UseVisualStyleBackColor = true;
//
// groupbox_plugins
@ -955,6 +1023,7 @@ namespace Greenshot {
this.groupbox_plugins.Size = new System.Drawing.Size(423, 314);
this.groupbox_plugins.TabIndex = 0;
this.groupbox_plugins.TabStop = false;
this.groupbox_plugins.Text = "Plugins";
//
// listview_plugins
//
@ -979,6 +1048,7 @@ namespace Greenshot {
this.button_pluginconfigure.Name = "button_pluginconfigure";
this.button_pluginconfigure.Size = new System.Drawing.Size(75, 23);
this.button_pluginconfigure.TabIndex = 1;
this.button_pluginconfigure.Text = "Configure";
this.button_pluginconfigure.UseVisualStyleBackColor = true;
this.button_pluginconfigure.Click += new System.EventHandler(this.Button_pluginconfigureClick);
//
@ -990,6 +1060,7 @@ namespace Greenshot {
this.tab_expert.Name = "tab_expert";
this.tab_expert.Size = new System.Drawing.Size(423, 320);
this.tab_expert.TabIndex = 5;
this.tab_expert.Text = "Expert";
this.tab_expert.UseVisualStyleBackColor = true;
//
// groupbox_expert
@ -1025,6 +1096,7 @@ namespace Greenshot {
this.checkbox_reuseeditor.SectionName = "Editor";
this.checkbox_reuseeditor.Size = new System.Drawing.Size(394, 24);
this.checkbox_reuseeditor.TabIndex = 31;
this.checkbox_reuseeditor.Text = "Reuse editor if possible";
this.checkbox_reuseeditor.UseVisualStyleBackColor = true;
//
// checkbox_minimizememoryfootprint
@ -1035,6 +1107,7 @@ namespace Greenshot {
this.checkbox_minimizememoryfootprint.PropertyName = "MinimizeWorkingSetSize";
this.checkbox_minimizememoryfootprint.Size = new System.Drawing.Size(394, 24);
this.checkbox_minimizememoryfootprint.TabIndex = 30;
this.checkbox_minimizememoryfootprint.Text = "Minimize memory footprint, but with a performance penalty (not adviced).";
this.checkbox_minimizememoryfootprint.UseVisualStyleBackColor = true;
//
// checkbox_checkunstableupdates
@ -1045,6 +1118,7 @@ namespace Greenshot {
this.checkbox_checkunstableupdates.PropertyName = "CheckForUnstable";
this.checkbox_checkunstableupdates.Size = new System.Drawing.Size(394, 24);
this.checkbox_checkunstableupdates.TabIndex = 29;
this.checkbox_checkunstableupdates.Text = "Check for unstable updates";
this.checkbox_checkunstableupdates.UseVisualStyleBackColor = true;
//
// checkbox_suppresssavedialogatclose
@ -1056,6 +1130,7 @@ namespace Greenshot {
this.checkbox_suppresssavedialogatclose.SectionName = "Editor";
this.checkbox_suppresssavedialogatclose.Size = new System.Drawing.Size(394, 24);
this.checkbox_suppresssavedialogatclose.TabIndex = 28;
this.checkbox_suppresssavedialogatclose.Text = "Suppress the save dialog when closing the editor";
this.checkbox_suppresssavedialogatclose.UseVisualStyleBackColor = true;
//
// label_counter
@ -1066,6 +1141,7 @@ namespace Greenshot {
this.label_counter.Name = "label_counter";
this.label_counter.Size = new System.Drawing.Size(246, 13);
this.label_counter.TabIndex = 27;
this.label_counter.Text = "The number for the ${NUM} in the filename pattern";
//
// textbox_counter
//
@ -1083,6 +1159,7 @@ namespace Greenshot {
this.label_footerpattern.Name = "label_footerpattern";
this.label_footerpattern.Size = new System.Drawing.Size(103, 13);
this.label_footerpattern.TabIndex = 25;
this.label_footerpattern.Text = "Printer footer pattern";
//
// textbox_footerpattern
//
@ -1100,6 +1177,7 @@ namespace Greenshot {
this.checkbox_thumbnailpreview.PropertyName = "ThumnailPreview";
this.checkbox_thumbnailpreview.Size = new System.Drawing.Size(394, 24);
this.checkbox_thumbnailpreview.TabIndex = 23;
this.checkbox_thumbnailpreview.Text = "Show window thumbnails in context menu (for Vista and windows 7)";
this.checkbox_thumbnailpreview.UseVisualStyleBackColor = true;
//
// checkbox_optimizeforrdp
@ -1110,6 +1188,7 @@ namespace Greenshot {
this.checkbox_optimizeforrdp.PropertyName = "OptimizeForRDP";
this.checkbox_optimizeforrdp.Size = new System.Drawing.Size(394, 24);
this.checkbox_optimizeforrdp.TabIndex = 22;
this.checkbox_optimizeforrdp.Text = "Make some optimizations for usage with remote desktop";
this.checkbox_optimizeforrdp.UseVisualStyleBackColor = true;
//
// checkbox_autoreducecolors
@ -1120,6 +1199,8 @@ namespace Greenshot {
this.checkbox_autoreducecolors.PropertyName = "OutputFileAutoReduceColors";
this.checkbox_autoreducecolors.Size = new System.Drawing.Size(408, 24);
this.checkbox_autoreducecolors.TabIndex = 21;
this.checkbox_autoreducecolors.Text = "Create an 8-bit image if the colors are less than 256 while having a > 8 bits ima" +
"ge";
this.checkbox_autoreducecolors.UseVisualStyleBackColor = true;
//
// label_clipboardformats
@ -1130,6 +1211,7 @@ namespace Greenshot {
this.label_clipboardformats.Name = "label_clipboardformats";
this.label_clipboardformats.Size = new System.Drawing.Size(88, 13);
this.label_clipboardformats.TabIndex = 20;
this.label_clipboardformats.Text = "Clipboard formats";
//
// checkbox_enableexpert
//
@ -1138,6 +1220,7 @@ namespace Greenshot {
this.checkbox_enableexpert.Name = "checkbox_enableexpert";
this.checkbox_enableexpert.Size = new System.Drawing.Size(394, 24);
this.checkbox_enableexpert.TabIndex = 19;
this.checkbox_enableexpert.Text = "I know what I am doing!";
this.checkbox_enableexpert.UseVisualStyleBackColor = true;
this.checkbox_enableexpert.CheckedChanged += new System.EventHandler(this.checkbox_enableexpert_CheckedChanged);
//
@ -1177,6 +1260,7 @@ namespace Greenshot {
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
this.Text = "Settings";
this.groupbox_preferredfilesettings.ResumeLayout(false);
this.groupbox_preferredfilesettings.PerformLayout();
this.groupbox_applicationsettings.ResumeLayout(false);
@ -1208,6 +1292,7 @@ namespace Greenshot {
this.groupbox_expert.ResumeLayout(false);
this.groupbox_expert.PerformLayout();
this.ResumeLayout(false);
}
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_notifications;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_minimizememoryfootprint;
@ -1302,5 +1387,6 @@ namespace Greenshot {
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_suppresssavedialogatclose;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_checkunstableupdates;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_reuseeditor;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_monochrome;
}
}

View file

@ -112,15 +112,15 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="colorButton_window_background.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABcAAAAYCAYAAAARfGZ1AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6

View file

@ -29,6 +29,7 @@ using Greenshot.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
using Greenshot.Core;
namespace Greenshot.Helpers {
/// <summary>
@ -38,13 +39,13 @@ namespace Greenshot.Helpers {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PrintHelper));
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
private Image image;
private ISurface surface;
private ICaptureDetails captureDetails;
private PrintDocument printDocument = new PrintDocument();
private PrintDialog printDialog = new PrintDialog();
public PrintHelper(Image image, ICaptureDetails captureDetails) {
this.image = image;
public PrintHelper(ISurface surface, ICaptureDetails captureDetails) {
this.surface = surface;
this.captureDetails = captureDetails;
printDialog.UseEXDialog = true;
printDocument.DocumentName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(conf.OutputFileFilenamePattern, captureDetails);
@ -74,8 +75,8 @@ namespace Greenshot.Helpers {
*/
protected virtual void Dispose(bool disposing) {
if (disposing) {
if (image != null) {
image.Dispose();
if (surface != null) {
surface.Dispose();
}
if (printDocument != null) {
printDocument.Dispose();
@ -84,7 +85,7 @@ namespace Greenshot.Helpers {
printDialog.Dispose();
}
}
image = null;
surface = null;
printDocument = null;
printDialog = null;
}
@ -100,7 +101,7 @@ namespace Greenshot.Helpers {
try {
if (printOptionsResult == null || printOptionsResult == DialogResult.OK) {
printDocument.PrinterSettings.PrinterName = printerName;
if (conf.OutputPrintGrayscale) {
if (!IsColorPrint()) {
printDocument.DefaultPageSettings.Color = false;
}
printDocument.Print();
@ -110,8 +111,8 @@ namespace Greenshot.Helpers {
LOG.Error("An error ocurred while trying to print", e);
MessageBox.Show(Language.GetString(LangKey.print_error), Language.GetString(LangKey.error));
}
image.Dispose();
image = null;
surface.Dispose();
surface = null;
return returnPrinterSettings;
}
@ -126,7 +127,7 @@ namespace Greenshot.Helpers {
DialogResult? printOptionsResult = ShowPrintOptionsDialog();
try {
if (printOptionsResult == null || printOptionsResult == DialogResult.OK) {
if (conf.OutputPrintGrayscale) {
if (IsColorPrint()) {
printDocument.DefaultPageSettings.Color = false;
}
printDocument.Print();
@ -138,11 +139,15 @@ namespace Greenshot.Helpers {
}
}
image.Dispose();
image = null;
surface.Dispose();
surface = null;
return returnPrinterSettings;
}
private bool IsColorPrint() {
return !conf.OutputPrintGrayscale && !conf.OutputPrintMonochrome;
}
/// <summary>
/// display print options dialog (if the user has not configured Greenshot not to)
/// </summary>
@ -158,6 +163,16 @@ namespace Greenshot.Helpers {
}
void DrawImageForPrint(object sender, PrintPageEventArgs e) {
// Create the output settins
SurfaceOutputSettings printOutputSettings = new SurfaceOutputSettings(OutputFormat.png, 100, false);
ApplyEffects(printOutputSettings);
Image image;
Boolean disposeImage = ImageOutput.CreateImageFromSurface(surface, printOutputSettings, out image);
try {
ContentAlignment alignment = conf.OutputPrintCenter ? ContentAlignment.MiddleCenter : ContentAlignment.TopLeft;
// prepare timestamp
@ -214,6 +229,29 @@ namespace Greenshot.Helpers {
}
}
e.Graphics.DrawImage(image, printRect, imageRect, GraphicsUnit.Pixel);
} finally {
if (disposeImage && image != null) {
image.Dispose();
image = null;
}
}
}
private void ApplyEffects(SurfaceOutputSettings printOutputSettings)
{
// TODO:
// add effects here
if (conf.OutputPrintMonochrome) {
byte threshold = conf.OutputPrintMonochromeThreshold;
printOutputSettings.Effects.Add(new MonochromeEffect(threshold));
printOutputSettings.ReduceColors = true;
}
// the invert effect should probably be the last
if (conf.OutputPrintInverted) {
printOutputSettings.Effects.Add(new InvertEffect());
}
}
}
}

View file

@ -198,6 +198,7 @@ Please check write accessibility of the selected storage location.</resource>
<resource name="printoptions_dontaskagain">Save options as default and do not ask again</resource>
<resource name="printoptions_inverted">Print with inverted colors</resource>
<resource name="printoptions_printgrayscale">Force grayscale printing</resource>
<resource name="printoptions_printmonochrome">Force black/white printing</resource>
<resource name="printoptions_timestamp">Print date / time at bottom of page</resource>
<resource name="printoptions_title">Greenshot print options</resource>
<resource name="qualitydialog_dontaskagain">Save as default quality and do not ask again</resource>

View file

@ -11,6 +11,7 @@ Features:
* General: Added Special-Folder support for the OutputPath/Filenames, now one can use the following values: MyPictures, MyMusic, MyDocuments, Personal, Desktop, ApplicationData, LocalApplicationData. Meaning one can now set the output path to e.g. ${MyPictures}
* Editor: The capture is now displayed in the center of the editor, the code for this was supplied by Viktar Karpach.
* Editor: Added horizontal and vertical alignment for text boxes.
* Printing: Added option to force monochrome (black/white) print
* Plug-in: Added Photobucket plugin
* Plug-in: Removed unneeded code from the Confluence Plug-in, this makes the Greenshot installer / .zip a bit smaller.

View file

@ -139,6 +139,10 @@ namespace GreenshotPlugin.Core {
public bool OutputPrintInverted;
[IniProperty("OutputPrintGrayscale", LanguageKey = "printoptions_printgrayscale", Description = "Force grayscale printing", DefaultValue = "false")]
public bool OutputPrintGrayscale;
[IniProperty("OutputPrintMonochrome", LanguageKey = "printoptions_printmonochrome", Description = "Force monorchrome printing", DefaultValue = "false")]
public bool OutputPrintMonochrome;
[IniProperty("OutputPrintMonochromeThreshold", Description = "Threshold for monochrome filter (0 - 255), lower value means less black", DefaultValue = "127")]
public byte OutputPrintMonochromeThreshold;
[IniProperty("OutputPrintFooter", LanguageKey = "printoptions_timestamp", Description = "Print footer on print?", DefaultValue = "true")]
public bool OutputPrintFooter;
[IniProperty("OutputPrintFooterPattern", Description = "Footer pattern", DefaultValue = "${capturetime:d\"D\"} ${capturetime:d\"T\"} - ${title}")]

View file

@ -105,9 +105,14 @@ namespace Greenshot.Core {
/// MonochromeEffect
/// </summary>
public class MonochromeEffect : IEffect {
private byte threshold;
/// <param name="threshold">Threshold for monochrome filter (0 - 255), lower value means less black</param>
public MonochromeEffect(byte threshold) {
this.threshold = threshold;
}
public Image Apply(Image sourceImage, out Point offsetChange) {
offsetChange = Point.Empty;
return ImageHelper.CreateMonochrome(sourceImage);
return ImageHelper.CreateMonochrome(sourceImage, threshold);
}
}

View file

@ -883,15 +883,16 @@ namespace GreenshotPlugin.Core {
/// <summary>
/// Returns a b/w of Bitmap
/// </summary>
/// <param name="sourceImage">Bitmap to create a b/w off</param>
/// <param name="sourceImage">Bitmap to create a b/w of</param>
/// <param name="threshold">Threshold for monochrome filter (0 - 255), lower value means less black</param>
/// <returns>b/w bitmap</returns>
public static Bitmap CreateMonochrome(Image sourceImage) {
public static Bitmap CreateMonochrome(Image sourceImage, byte threshold) {
using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(sourceImage, sourceImage.PixelFormat)) {
fastBitmap.Lock();
for (int y = 0; y < fastBitmap.Height; y++) {
for (int x = 0; x < fastBitmap.Width; x++) {
Color color = fastBitmap.GetColorAt(x, y);
int colorBrightness = (color.R + color.G + color.B > 382) ? 255 : 0;
int colorBrightness = ((color.R + color.G + color.B) / 3 > threshold) ? 255 : 0;
Color monoColor = Color.FromArgb(color.A, colorBrightness, colorBrightness, colorBrightness);
fastBitmap.SetColorAt(x, y, monoColor);
}