mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Add crop()
git-svn-id: https://zxing.googlecode.com/svn/trunk@2256 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
e4fcc8ee02
commit
23ce7f4584
|
@ -38,8 +38,14 @@ public final class PlanarYUVLuminanceSource extends LuminanceSource {
|
||||||
private final int left;
|
private final int left;
|
||||||
private final int top;
|
private final int top;
|
||||||
|
|
||||||
public PlanarYUVLuminanceSource(byte[] yuvData, int dataWidth, int dataHeight, int left, int top,
|
public PlanarYUVLuminanceSource(byte[] yuvData,
|
||||||
int width, int height, boolean reverseHorizontal) {
|
int dataWidth,
|
||||||
|
int dataHeight,
|
||||||
|
int left,
|
||||||
|
int top,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
boolean reverseHorizontal) {
|
||||||
super(width, height);
|
super(width, height);
|
||||||
|
|
||||||
if (left + width > dataWidth || top + height > dataHeight) {
|
if (left + width > dataWidth || top + height > dataHeight) {
|
||||||
|
@ -106,6 +112,18 @@ public final class PlanarYUVLuminanceSource extends LuminanceSource {
|
||||||
return true;
|
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() {
|
public Bitmap renderCroppedGreyscaleBitmap() {
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
int height = getHeight();
|
int height = getHeight();
|
||||||
|
|
Loading…
Reference in a new issue