修复 image wrapper多余release导致崩溃的问题
This commit is contained in:
@@ -122,6 +122,20 @@ module.exports = function (__runtime__, scope) {
|
||||
return matToImage(mat);
|
||||
}
|
||||
|
||||
images.resize = function(img, size, interpolation) {
|
||||
var mat = newMat();
|
||||
interpolation = Imgproc["INTER_" + (interpolation || "LINEAR")];
|
||||
Imgproc.resize(img.mat, mat, newSize(size), 0, 0, interpolation);
|
||||
return matToImage(mat);
|
||||
}
|
||||
|
||||
images.scale = function(img, fx, fy, interpolation) {
|
||||
var mat = newMat();
|
||||
interpolation = Imgproc["INTER_" + (interpolation || "LINEAR")];
|
||||
Imgproc.resize(img.mat, mat, newSize([0, 0]), fx, fy, interpolation);
|
||||
return matToImage(mat);
|
||||
}
|
||||
|
||||
images.detectsColor = function (img, color, x, y, threshold, algorithm) {
|
||||
color = parseColor(color);
|
||||
algorithm = algorithm || "diff";
|
||||
|
||||
@@ -156,12 +156,6 @@ public class ImageWrapper {
|
||||
throw new IllegalStateException("image has been recycled");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
recycle();
|
||||
}
|
||||
|
||||
public ImageWrapper clone() {
|
||||
ensureNotRecycled();
|
||||
if (mBitmap == null) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import org.opencv.android.InstallCallbackInterface;
|
||||
import org.opencv.android.LoaderCallbackInterface;
|
||||
import org.opencv.android.OpenCVLoader;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
|
||||
|
||||
@@ -350,6 +350,7 @@ public class TextViewInflater<V extends TextView> extends BaseViewInflater<V> {
|
||||
case "textColor":
|
||||
view.setTextColor(Colors.parse(view.getContext(), value));
|
||||
break;
|
||||
case "size":
|
||||
case "textSize":
|
||||
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, Dimensions.parseToPixel(value, view));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user