feat(autojs): UiSelector.indexInParent

This commit is contained in:
hyb1996
2018-05-28 13:14:59 +08:00
parent 9911c9146d
commit ac0e9952c8
3 changed files with 25 additions and 1 deletions

View File

@@ -79,7 +79,7 @@ public class ImageWrapper {
}
public Mat getMat() {
if (mMat == null) {
if (mMat == null && mBitmap != null) {
mMat = new Mat();
Utils.bitmapToMat(mBitmap, mMat);
}
@@ -87,6 +87,7 @@ public class ImageWrapper {
}
public void saveTo(String path) {
ensureNotRecycled();
if (mBitmap != null) {
try {
mBitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(path));
@@ -99,6 +100,7 @@ public class ImageWrapper {
}
public int pixel(int x, int y) {
ensureNotRecycled();
if (mBitmap != null) {
return mBitmap.getPixel(x, y);
}
@@ -121,4 +123,9 @@ public class ImageWrapper {
}
}
private void ensureNotRecycled() {
if (mBitmap == null && mMat == null)
throw new IllegalStateException("image has been recycled");
}
}