-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancements for image scanning #29
base: master
Are you sure you want to change the base?
Changes from all commits
123db70
d45480b
1fe5007
bf3a412
6818ba2
23bdff1
983f0e7
b421cbf
d1aa2e2
0a6a2dc
f8d2115
4ffd5b1
dfcffa3
db19019
72f22f6
c7fef38
0158181
9510a16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// This code is part of scanline and published under MIT license. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Describes insets that can be applied to a rectangle. | ||
struct Insets { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICS UIEdgeInsets is only part of UIKit, which is not linked against scanline as it is a command line application. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, right... |
||
|
||
let left: CGFloat | ||
let right: CGFloat | ||
let top: CGFloat | ||
let bottom: CGFloat | ||
|
||
init(left: Double, top: Double, right: Double, bottom: Double) { | ||
self.left = CGFloat(left) | ||
self.top = CGFloat(top) | ||
self.right = CGFloat(right) | ||
self.bottom = CGFloat(bottom) | ||
} | ||
|
||
init(fromString insets: String) { | ||
let insetValues = insets.split(separator: ":") | ||
self.init(left: Double(insetValues[0])!, top: Double(insetValues[1])!, right: Double(insetValues[2])!, bottom: Double(insetValues[1])!) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to avoid the force unwraps here? |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
// | ||
// ScanConfiguration.m | ||
// scanline | ||
// | ||
// Created by Scott J. Kleper on 9/26/13. | ||
// | ||
// This code is part of scanline and published under MIT license. | ||
// | ||
|
||
#import "ScanConfiguration.h" | ||
|
@@ -92,6 +88,31 @@ + (NSDictionary*)configOptions | |
@"type": @"flag", | ||
@"description": @"When specified, only the scanner with the exact name specified will be used (no fuzzy matching)" | ||
}, | ||
ScanlineConfigOptionArea: @{ | ||
@"synonyms": @[@"size"], | ||
@"type": @"string", | ||
@"description": @"Specify the size of the area that should be scanned in cm. Forat is <width>x<height>, e.g. 20x20 (Default is the whole flatbed scan area)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *Format :) |
||
}, | ||
ScanlineConfigOptionCreationDate: @{ | ||
@"type": @"string", | ||
@"description": @"When specified, the EXIF creation date is set to the given date (Format YYYY:MM:DD)" | ||
}, | ||
ScanlineConfigOptionInsets: @{ | ||
@"synonyms": @[@"cutoff"], | ||
@"type": @"string", | ||
@"description": @"The number of pixels to cut off from each side (Format Left:Top:Right:Bottom)", | ||
@"default": @"0:0:0:0" | ||
}, | ||
ScanlineConfigOptionAutoTrim: @{ | ||
@"synonyms": @[@"trim-whitespace"], | ||
@"type": @"flag", | ||
@"description": @"Trims whitespace around the image (useful for photos)" | ||
}, | ||
ScanlineConfigOptionQuality: @{ | ||
@"type": @"string", | ||
@"description": @"Specifes the quality of the image. Only used when -jpg is enabled. Value must be between 0 (low quality, small file) and 100 (best, big file). (Default is 90)", | ||
@"default": @"90" | ||
}, | ||
}; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be necessary. If I revert it back to
#import "ScanConfiguration.h"
, I'm able to run the tests. Although I also had to remove the app source files from the test target, which they shouldn't have been in. Maybe that was the issue here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. When I revert the change I get
'ScanConfiguration.h' file not found
. Removing the source files from CompileSources of the Test target unfortunately does not fix things for me:However I'm not very familiar with XCode nor the Swift build system. Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get it to work by doing the following:
#import "ScanConfiguration.h"
inScanConfigurationTests.m
ScanConfigurationTests.m
andScanConfiguration.m
from theCompile Sources
step#import "scanline-Swift.h"
fromScanConfiguration.m
It's not ideal -- we shouldn't need any of the app source files in the test target -- but I'm not sure what the issue is right now with that.