mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -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 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();
|
||||
|
|
Loading…
Reference in a new issue