Add crop()

git-svn-id: https://zxing.googlecode.com/svn/trunk@2256 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-04-22 23:52:20 +00:00
parent e4fcc8ee02
commit 23ce7f4584

View file

@ -38,8 +38,14 @@ public final class PlanarYUVLuminanceSource extends LuminanceSource {
private final int left;
private final int top;
public PlanarYUVLuminanceSource(byte[] yuvData, int dataWidth, int dataHeight, int left, int top,
int width, int height, boolean reverseHorizontal) {
public PlanarYUVLuminanceSource(byte[] yuvData,
int dataWidth,
int dataHeight,
int left,
int top,
int width,
int height,
boolean reverseHorizontal) {
super(width, height);
if (left + width > dataWidth || top + height > dataHeight) {
@ -106,6 +112,18 @@ public final class PlanarYUVLuminanceSource extends LuminanceSource {
return true;
}
@Override
public LuminanceSource crop(int left, int top, int width, int height) {
return new PlanarYUVLuminanceSource(yuvData,
dataWidth,
dataHeight,
this.left + left,
this.top + top,
width,
height,
false);
}
public Bitmap renderCroppedGreyscaleBitmap() {
int width = getWidth();
int height = getHeight();