Send Labels also without image

This commit is contained in:
Olga Miller 2017-01-06 09:09:05 +01:00
parent b2574a666d
commit eefa55bb6d

View file

@ -160,6 +160,8 @@ public class CropView extends ImageView {
} }
public void rotateImage(int orientation) { public void rotateImage(int orientation) {
if (!mImageOK)
return;
mOrientation += orientation; mOrientation += orientation;
mOrientation %= 360; mOrientation %= 360;
if (orientation == 90 || orientation == 270) { if (orientation == 90 || orientation == 270) {
@ -167,11 +169,9 @@ public class CropView extends ImageView {
mImageWidth = mImageHeight; mImageWidth = mImageHeight;
mImageHeight = tmp; mImageHeight = tmp;
} }
if (mImageOK) {
resetInputRect(); resetInputRect();
invalidate(); invalidate();
} }
}
public void setNoBitmap() { public void setNoBitmap() {
mImageOK = false; mImageOK = false;
@ -350,18 +350,15 @@ public class CropView extends ImageView {
} }
public Bitmap getBitmap() { public Bitmap getBitmap() {
if (!mImageOK)
return null;
Bitmap result = Bitmap.createBitmap(mModeSize.width(), mModeSize.height(), Bitmap.Config.ARGB_8888); Bitmap result = Bitmap.createBitmap(mModeSize.width(), mModeSize.height(), Bitmap.Config.ARGB_8888);
mImageDrawRect.set(getIntRect(mInputRect));
adjustCanvasAndImageRect(mModeSize.width(), mModeSize.height());
Canvas canvas = new Canvas(result); Canvas canvas = new Canvas(result);
canvas.drawColor(Color.BLACK); canvas.drawColor(Color.BLACK);
if (mImageOK) {
mImageDrawRect.set(getIntRect(mInputRect));
adjustCanvasAndImageRect(mModeSize.width(), mModeSize.height());
drawBitmap(canvas); drawBitmap(canvas);
}
mLabelCollection.draw(canvas, mOutputRect, new Rect(0, 0, mModeSize.width(), mModeSize.height())); mLabelCollection.draw(canvas, mOutputRect, new Rect(0, 0, mModeSize.width(), mModeSize.height()));
return result; return result;
} }