mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
You can now dump the black point for URLs to the pwd.
git-svn-id: https://zxing.googlecode.com/svn/trunk@954 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0a4e715ae4
commit
70eab118c1
|
@ -170,7 +170,6 @@ public final class CommandLineRunner {
|
||||||
// Writes out a single PNG which is three times the width of the input image, containing from left
|
// Writes out a single PNG which is three times the width of the input image, containing from left
|
||||||
// to right: the original image, the row sampling monochrome version, and the 2D sampling
|
// to right: the original image, the row sampling monochrome version, and the 2D sampling
|
||||||
// monochrome version.
|
// monochrome version.
|
||||||
// TODO: Currently fails on URLs. Would be nice to handle gracefully and write the output to pwd.
|
|
||||||
private static void dumpBlackPoint(URI uri, BufferedImage image, MonochromeBitmapSource source) {
|
private static void dumpBlackPoint(URI uri, BufferedImage image, MonochromeBitmapSource source) {
|
||||||
String inputName = uri.getPath();
|
String inputName = uri.getPath();
|
||||||
if (inputName.contains(".mono.png")) {
|
if (inputName.contains(".mono.png")) {
|
||||||
|
@ -235,7 +234,14 @@ public final class CommandLineRunner {
|
||||||
BufferedImage result = new BufferedImage(stride, height, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage result = new BufferedImage(stride, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
result.setRGB(0, 0, stride, height, pixels, 0, stride);
|
result.setRGB(0, 0, stride, height, pixels, 0, stride);
|
||||||
|
|
||||||
|
// Use the current working directory for URLs
|
||||||
String resultName = inputName;
|
String resultName = inputName;
|
||||||
|
if (uri.getScheme().equals("http")) {
|
||||||
|
int pos = resultName.lastIndexOf('/');
|
||||||
|
if (pos > 0) {
|
||||||
|
resultName = "." + resultName.substring(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
int pos = resultName.lastIndexOf('.');
|
int pos = resultName.lastIndexOf('.');
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
resultName = resultName.substring(0, pos);
|
resultName = resultName.substring(0, pos);
|
||||||
|
|
Loading…
Reference in a new issue