mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Small tweaks on top of Daniel's excellent refactoring
git-svn-id: https://zxing.googlecode.com/svn/trunk@420 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
7b2cafe970
commit
31b8b3d226
|
@ -32,7 +32,7 @@ public abstract class BaseMonochromeBitmapSource implements MonochromeBitmapSour
|
||||||
private static final int LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
|
private static final int LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
|
||||||
private static final int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
|
private static final int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
|
||||||
|
|
||||||
public BaseMonochromeBitmapSource() {
|
protected BaseMonochromeBitmapSource() {
|
||||||
blackPoint = 0x7F;
|
blackPoint = 0x7F;
|
||||||
lastMethod = null;
|
lastMethod = null;
|
||||||
lastArgument = 0;
|
lastArgument = 0;
|
||||||
|
@ -76,11 +76,6 @@ public abstract class BaseMonochromeBitmapSource implements MonochromeBitmapSour
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract int getHeight();
|
|
||||||
public abstract int getWidth();
|
|
||||||
public abstract int getLuminance(int x, int y);
|
|
||||||
public abstract void cacheRowForLuminance(int y);
|
|
||||||
|
|
||||||
public void estimateBlackPoint(BlackPointEstimationMethod method, int argument) throws ReaderException {
|
public void estimateBlackPoint(BlackPointEstimationMethod method, int argument) throws ReaderException {
|
||||||
if (!method.equals(lastMethod) || argument != lastArgument) {
|
if (!method.equals(lastMethod) || argument != lastArgument) {
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.google.zxing.common.BaseMonochromeBitmapSource;
|
||||||
import javax.microedition.lcdui.Image;
|
import javax.microedition.lcdui.Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>An implementation based on Java ME's {@link java.awt.Image} representation.</p>
|
* <p>An implementation based on Java ME's {@link Image} representation.</p>
|
||||||
*
|
*
|
||||||
* @author Sean Owen (srowen@google.com), Daniel Switkin (dswitkin@google.com)
|
* @author Sean Owen (srowen@google.com), Daniel Switkin (dswitkin@google.com)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -97,6 +97,7 @@ public final class BufferedImageMonochromeBitmapSource extends BaseMonochromeBit
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MonochromeBitmapSource rotateCounterClockwise() {
|
public MonochromeBitmapSource rotateCounterClockwise() {
|
||||||
if (!isRotateSupported()) {
|
if (!isRotateSupported()) {
|
||||||
throw new IllegalStateException("Rotate not supported");
|
throw new IllegalStateException("Rotate not supported");
|
||||||
|
@ -116,6 +117,7 @@ public final class BufferedImageMonochromeBitmapSource extends BaseMonochromeBit
|
||||||
sourceWidth - left);
|
sourceWidth - left);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isRotateSupported() {
|
public boolean isRotateSupported() {
|
||||||
// Can't run AffineTransforms on images of unknown format
|
// Can't run AffineTransforms on images of unknown format
|
||||||
return image.getType() != BufferedImage.TYPE_CUSTOM;
|
return image.getType() != BufferedImage.TYPE_CUSTOM;
|
||||||
|
|
Loading…
Reference in a new issue