private final int mDataWidth;
private final int mCropTop;
private final int mCropLeft;
- private final int mCropBottom;
- private final int mCropRight;
/**
* Builds an object around a YUV buffer from the camera. The image is not cropped.
int cropLeft,
int cropBottom,
int cropRight) {
+ super(cropRight - cropLeft, cropBottom - cropTop);
if (cropRight - cropLeft > dataWidth || cropBottom - cropTop > dataHeight) {
throw new IllegalArgumentException();
}
mDataWidth = dataWidth;
this.mCropTop = cropTop;
this.mCropLeft = cropLeft;
- this.mCropBottom = cropBottom;
- this.mCropRight = cropRight;
- }
-
- @Override
- public int getHeight() {
- return mCropBottom - mCropTop;
- }
-
- @Override
- public int getWidth() {
- return mCropRight - mCropLeft;
}
/**
* @return The luminance as an int, from 0-255
*/
@Override
- protected int getLuminance(int x, int y) {
+ public int getLuminance(int x, int y) {
return mYUVData[(y + mCropTop) * mDataWidth + x + mCropLeft] & 0xff;
}
@Override
- protected int[] getLuminanceRow(int y, int[] row) {
+ public int[] getLuminanceRow(int y, int[] row) {
int width = getWidth();
if (row == null || row.length < width) {
row = new int[width];
}
@Override
- protected int[] getLuminanceColumn(int x, int[] column) {
+ public int[] getLuminanceColumn(int x, int[] column) {
int height = getHeight();
if (column == null || column.length < height) {
column = new int[height];