Applied my "patch" which refactors the complete codebase to have IEffect support, this is an interface which can be used to supply effects to a bitmap. These effects can now be passed to the OutputSettings (which now is called SurfaceOutputSettings) to control how the output is modified. This is very useful for e.g. OCR which needs a grayscale & resized image.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2377 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-12 09:51:41 +00:00
commit 0c7e16a771
33 changed files with 212 additions and 148 deletions

View file

@ -26,6 +26,7 @@ using System.Windows.Forms;
using Greenshot.Plugin.Drawing;
using System.IO;
using System.Collections.Generic;
using Greenshot.Core;
namespace Greenshot.Plugin {
/// <summary>
@ -33,7 +34,6 @@ namespace Greenshot.Plugin {
/// </summary>
//public enum HorizontalAlignment {LEFT, CENTER, RIGHT};
public enum VerticalAlignment {TOP, CENTER, BOTTOM};
public enum Effects { Shadow, TornEdge, Border, Grayscale, RotateClockwise, RotateCounterClockwise, Invert };
public enum SurfaceMessageTyp {
FileSaved,
@ -148,7 +148,7 @@ namespace Greenshot.Plugin {
}
void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable);
void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message);
void ApplyBitmapEffect(Effects effect);
void ApplyBitmapEffect(IEffect effect);
void RemoveCursor();
bool HasCursor {
get;

View file

@ -26,6 +26,7 @@ using System.Windows.Forms;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
using Greenshot.Core;
namespace Greenshot.Plugin {
[Serializable]
@ -74,25 +75,26 @@ namespace Greenshot.Plugin {
// Delegates for hooking up events.
public delegate void HotKeyHandler();
public class OutputSettings {
public class SurfaceOutputSettings {
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
private bool reduceColors;
private List<IEffect> effects = new List<IEffect>();
public OutputSettings() {
public SurfaceOutputSettings() {
Format = conf.OutputFileFormat;
JPGQuality = conf.OutputFileJpegQuality;
ReduceColors = conf.OutputFileReduceColors;
}
public OutputSettings(OutputFormat format) : this() {
public SurfaceOutputSettings(OutputFormat format) : this() {
Format = format;
}
public OutputSettings(OutputFormat format, int quality) : this(format) {
public SurfaceOutputSettings(OutputFormat format, int quality) : this(format) {
JPGQuality = quality;
}
public OutputSettings(OutputFormat format, int quality, bool reduceColors) : this(format, quality) {
public SurfaceOutputSettings(OutputFormat format, int quality, bool reduceColors) : this(format, quality) {
ReduceColors = reduceColors;
}
@ -106,6 +108,17 @@ namespace Greenshot.Plugin {
set;
}
public bool SaveBackgroundOnly {
get;
set;
}
public List<IEffect> Effects {
get {
return effects;
}
}
public bool ReduceColors {
get {
// Fix for Bug #3468436, force quantizing when output format is gif as this has only 256 colors!