Refactoring: created a OutputSettings class to contain all the output settings for writing files. Default the settings are loaded from the configuration, in a later version it will be possible to have separate settings for every destination and these can be configured at one place... the settings form.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1815 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-24 16:44:34 +00:00
parent 5902a3d236
commit e5fd88ebd3
21 changed files with 182 additions and 123 deletions

View file

@ -152,7 +152,8 @@ namespace GreenshotOCR {
private const int MIN_HEIGHT = 130;
public static void DoOCR(ISurface surface) {
string filePath = null;
OutputSettings outputSettings = new OutputSettings(OutputFormat.bmp);
using (Image capturedImage = surface.GetImageForExport()) {
if (capturedImage.Width < MIN_WIDTH || capturedImage.Height < MIN_HEIGHT) {
LOG.Debug("Captured image is not big enough for OCR, growing image...");
@ -163,10 +164,10 @@ namespace GreenshotOCR {
graphics.Clear(Color.White);
graphics.DrawImage(capturedImage, Point.Empty);
}
filePath = host.SaveToTmpFile(tmpImage, OutputFormat.bmp, 100, false);
filePath = host.SaveToTmpFile(tmpImage, outputSettings);
}
} else {
filePath = host.SaveToTmpFile(capturedImage, OutputFormat.bmp, 100, false);
filePath = host.SaveToTmpFile(capturedImage, outputSettings);
}
}