6.6.2 - Alpha4 - 修复 Gradle 构建时 Kotlin Array 泛型及依赖缺失等警告消息
This commit is contained in:
1 parent
17e202a5b1
commit
aab0e7e254
8 files changed
+71
-69
No files matched your search
@@ -35,6 +35,7 @@
|
|||||||
"升级 Gradle 版本 8.12 -> 8.13",
|
"升级 Gradle 版本 8.12 -> 8.13",
|
||||||
"升级 Rhino 版本 1.8.0-SNAPSHOT -> 1.8.1-SNAPSHOT",
|
"升级 Rhino 版本 1.8.0-SNAPSHOT -> 1.8.1-SNAPSHOT",
|
||||||
"升级 Androidx Recyclerview 版本 1.3.2 -> 1.4.0",
|
"升级 Androidx Recyclerview 版本 1.3.2 -> 1.4.0",
|
||||||
|
"升级 Androidx WebKit 版本 1.12.1 -> 1.13.0",
|
||||||
"升级 Pinyin4j 版本 2.5.0 -> 2.5.1"
|
"升级 Pinyin4j 版本 2.5.0 -> 2.5.1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,7 +42,12 @@ dependencies {
|
|||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
|
|
||||||
implementation("com.madgag.spongycastle:core:1.58.0.0")
|
// @Hint by SuperMonster003 on Mar 14, 2025.
|
||||||
|
// ! Dependency "prov" contains "core" (zh-CN: 依赖 "prov" 已包含 "core"):
|
||||||
|
// ! | \--- com.madgag.spongycastle:prov:1.58.0.0
|
||||||
|
// ! | +--- com.madgag.spongycastle:core:1.58.0.0
|
||||||
|
// ! | \--- junit:junit:4.12 (*)
|
||||||
|
// # implementation("com.madgag.spongycastle:core:1.58.0.0")
|
||||||
implementation("com.madgag.spongycastle:prov:1.58.0.0")
|
implementation("com.madgag.spongycastle:prov:1.58.0.0")
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ dependencies /* Unclassified */ {
|
|||||||
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||||
|
|
||||||
// Webkit
|
// Webkit
|
||||||
implementation("androidx.webkit:webkit:1.12.1")
|
implementation("androidx.webkit:webkit:1.13.0")
|
||||||
|
|
||||||
// Gson
|
// Gson
|
||||||
implementation("com.google.code.gson:gson:2.11.0")
|
implementation("com.google.code.gson:gson:2.11.0")
|
||||||
@@ -216,6 +216,9 @@ dependencies /* Unclassified */ {
|
|||||||
|
|
||||||
// ApkSigner
|
// ApkSigner
|
||||||
implementation(project(":modules:apksigner"))
|
implementation(project(":modules:apksigner"))
|
||||||
|
|
||||||
|
// Spongy Castle
|
||||||
|
implementation("com.madgag.spongycastle:prov:1.58.0.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies /* MIME */ {
|
dependencies /* MIME */ {
|
||||||
@@ -639,7 +642,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
val proguardFiles = arrayOf(
|
val proguardFiles = arrayOf<Any>(
|
||||||
getDefaultProguardFile("proguard-android.txt"),
|
getDefaultProguardFile("proguard-android.txt"),
|
||||||
"proguard-rules.pro",
|
"proguard-rules.pro",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ open class WebViewAttributes(scriptRuntime: ScriptRuntime, resourceParser: Resou
|
|||||||
registerAttr("blockNetworkImage") { view.settings.blockNetworkImage = it.toBoolean() }
|
registerAttr("blockNetworkImage") { view.settings.blockNetworkImage = it.toBoolean() }
|
||||||
registerAttr("blockNetworkLoads") { view.settings.blockNetworkLoads = it.toBoolean() }
|
registerAttr("blockNetworkLoads") { view.settings.blockNetworkLoads = it.toBoolean() }
|
||||||
registerAttrs(arrayOf("enableBuiltInZoomControls", "builtInZoomControls")) { view.settings.builtInZoomControls = it.toBoolean() }
|
registerAttrs(arrayOf("enableBuiltInZoomControls", "builtInZoomControls")) { view.settings.builtInZoomControls = it.toBoolean() }
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
registerAttrs(arrayOf("enableDatabase", "databaseEnabled", "isDatabaseEnabled")) { view.settings.databaseEnabled = it.toBoolean() }
|
registerAttrs(arrayOf("enableDatabase", "databaseEnabled", "isDatabaseEnabled")) { view.settings.databaseEnabled = it.toBoolean() }
|
||||||
registerAttrs(arrayOf("fontSize", "defaultFontSize")) { view.settings.defaultFontSize = it.toInt() }
|
registerAttrs(arrayOf("fontSize", "defaultFontSize")) { view.settings.defaultFontSize = it.toInt() }
|
||||||
registerAttrs(arrayOf("fixedFontSize", "defaultFixedFontSize")) { view.settings.defaultFixedFontSize = it.toInt() }
|
registerAttrs(arrayOf("fixedFontSize", "defaultFixedFontSize")) { view.settings.defaultFixedFontSize = it.toInt() }
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun copy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsOnlyOne(args) { o ->
|
fun copy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsOnlyOne(args) { o ->
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.copy must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.copy must be a ImageWrapper" }
|
||||||
scriptRuntime.images.copy(image)
|
scriptRuntime.images.copy(image)
|
||||||
}
|
}
|
||||||
@@ -201,13 +201,13 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
when (it.size) {
|
when (it.size) {
|
||||||
5 -> {
|
5 -> {
|
||||||
val (o, x, y, w, h) = it
|
val (o, x, y, w, h) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.clip must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.clip must be a ImageWrapper" }
|
||||||
scriptRuntime.images.clip(image, coerceIntNumber(x), coerceIntNumber(y), coerceIntNumber(w), coerceIntNumber(h))
|
scriptRuntime.images.clip(image, coerceIntNumber(x), coerceIntNumber(y), coerceIntNumber(w), coerceIntNumber(h))
|
||||||
}
|
}
|
||||||
2 -> {
|
2 -> {
|
||||||
val (o, region) = it
|
val (o, region) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.clip must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.clip must be a ImageWrapper" }
|
||||||
when {
|
when {
|
||||||
region.isJsNullish() -> image.apply { shoot() }
|
region.isJsNullish() -> image.apply { shoot() }
|
||||||
@@ -228,7 +228,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun pixel(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsLength(args, 3) {
|
fun pixel(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsLength(args, 3) {
|
||||||
val (o, x, y) = it
|
val (o, x, y) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.pixel must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.pixel must be a ImageWrapper" }
|
||||||
ApiImages.pixel(image, coerceIntNumber(x), coerceIntNumber(y))
|
ApiImages.pixel(image, coerceIntNumber(x), coerceIntNumber(y))
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun save(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 2..4) {
|
fun save(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 2..4) {
|
||||||
val (o, path, format, quality) = it
|
val (o, path, format, quality) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.save must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.save must be a ImageWrapper" }
|
||||||
require(!path.isJsNullish()) { "Argument path for images.save must be non-nullish" }
|
require(!path.isJsNullish()) { "Argument path for images.save must be non-nullish" }
|
||||||
scriptRuntime.images.save(image, scriptRuntime.files.path(coerceString(path)), parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_SAVE_QUALITY))
|
scriptRuntime.images.save(image, scriptRuntime.files.path(coerceString(path)), parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_SAVE_QUALITY))
|
||||||
@@ -307,7 +307,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun saveImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 2..4) {
|
fun saveImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 2..4) {
|
||||||
val (o, path, format, quality) = it
|
val (o, path, format, quality) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.saveImage must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.saveImage must be a ImageWrapper" }
|
||||||
require(!path.isJsNullish()) { "Argument path for images.saveImage must be non-nullish" }
|
require(!path.isJsNullish()) { "Argument path for images.saveImage must be non-nullish" }
|
||||||
scriptRuntime.images.save(image, scriptRuntime.files.path(coerceString(path)), parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_SAVE_QUALITY))
|
scriptRuntime.images.save(image, scriptRuntime.files.path(coerceString(path)), parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_SAVE_QUALITY))
|
||||||
@@ -316,7 +316,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun invert(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsOnlyOne(args) { o ->
|
fun invert(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsOnlyOne(args) { o ->
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.invert must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.invert must be a ImageWrapper" }
|
||||||
scriptRuntime.images.invert(image)
|
scriptRuntime.images.invert(image)
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun grayscale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 1..2) {
|
fun grayscale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 1..2) {
|
||||||
val (o, dstCn) = it
|
val (o, dstCn) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.grayscale must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.grayscale must be a ImageWrapper" }
|
||||||
cvtColor(scriptRuntime, arrayOf(image, "BGR2GRAY", dstCn))
|
cvtColor(scriptRuntime, arrayOf(image, "BGR2GRAY", dstCn))
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun isGrayscale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsOnlyOne(args) { o ->
|
fun isGrayscale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsOnlyOne(args) { o ->
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
val mat = when (image) {
|
val mat = when (image) {
|
||||||
is OpencvMat -> image
|
is OpencvMat -> image
|
||||||
is ImageWrapper -> image.mat
|
is ImageWrapper -> image.mat
|
||||||
@@ -359,7 +359,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun threshold(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 3..4) {
|
fun threshold(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 3..4) {
|
||||||
val (o, threshold, maxVal, type) = it
|
val (o, threshold, maxVal, type) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.threshold must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.threshold must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -372,7 +372,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun inRange(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 3) {
|
fun inRange(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 3) {
|
||||||
val (o, lowerBound, upperBound) = it
|
val (o, lowerBound, upperBound) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.inRange must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.inRange must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val dst = AutoJsMat()
|
val dst = AutoJsMat()
|
||||||
@@ -385,7 +385,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun interval(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 3) {
|
fun interval(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 3) {
|
||||||
val (o, color, threshold) = it
|
val (o, color, threshold) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.interval must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.interval must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val (lowerBound, upperBound) = parseScalars(Colors.toIntRhino(color), coerceNumber(threshold))
|
val (lowerBound, upperBound) = parseScalars(Colors.toIntRhino(color), coerceNumber(threshold))
|
||||||
@@ -400,7 +400,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun adaptiveThreshold(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 6) {
|
fun adaptiveThreshold(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 6) {
|
||||||
val (o, maxValue, adaptiveMethod, thresholdType, blockSize, C) = it
|
val (o, maxValue, adaptiveMethod, thresholdType, blockSize, C) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.adaptiveThreshold must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.adaptiveThreshold must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -415,7 +415,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun blur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..4) {
|
fun blur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..4) {
|
||||||
val (o, ksize, anchor, type) = it
|
val (o, ksize, anchor, type) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.blur must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.blur must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -433,7 +433,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun medianBlur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 2) {
|
fun medianBlur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 2) {
|
||||||
val (o, size) = it
|
val (o, size) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.medianBlur must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.medianBlur must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val ksize = when (size) {
|
val ksize = when (size) {
|
||||||
@@ -467,7 +467,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun gaussianBlur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..5) {
|
fun gaussianBlur(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..5) {
|
||||||
val (o, size, sigmaX, sigmaY, type) = it
|
val (o, size, sigmaX, sigmaY, type) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.gaussianBlur must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.gaussianBlur must be a ImageWrapper" }
|
||||||
/* 按需初始化 OpenCV. */
|
/* 按需初始化 OpenCV. */
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -489,7 +489,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun bilateralFilter(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 1..5) {
|
fun bilateralFilter(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 1..5) {
|
||||||
val (o, d, sigmaColor, sigmaSpace, borderType) = it
|
val (o, d, sigmaColor, sigmaSpace, borderType) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.bilateralFilter must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.bilateralFilter must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -505,7 +505,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun cvtColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
fun cvtColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, code, dstCn) = it
|
val (o, code, dstCn) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.cvtColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.cvtColor must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -522,7 +522,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findCircles(scriptRuntime: ScriptRuntime, args: Array<out Any?>): List<HoughCirclesResult> = ensureArgumentsLengthInRange(args, 1..2) {
|
fun findCircles(scriptRuntime: ScriptRuntime, args: Array<out Any?>): List<HoughCirclesResult> = ensureArgumentsLengthInRange(args, 1..2) {
|
||||||
val (o, optionsArg) = it
|
val (o, optionsArg) = it
|
||||||
val rawImage = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val rawImage = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(rawImage is ImageWrapper) { "Argument grayImage for images.findCircles must be a ImageWrapper" }
|
require(rawImage is ImageWrapper) { "Argument grayImage for images.findCircles must be a ImageWrapper" }
|
||||||
val grayImage = if (isGrayscale(scriptRuntime, arrayOf(rawImage))) rawImage else grayscale(scriptRuntime, arrayOf(rawImage))
|
val grayImage = if (isGrayscale(scriptRuntime, arrayOf(rawImage))) rawImage else grayscale(scriptRuntime, arrayOf(rawImage))
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -564,7 +564,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun resize(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
fun resize(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, size, interpolation) = it
|
val (o, size, interpolation) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.resize must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.resize must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -577,7 +577,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun scale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 3..4) {
|
fun scale(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 3..4) {
|
||||||
val (o, fx, fy, interpolation) = it
|
val (o, fx, fy, interpolation) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.scale must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.scale must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val mat = AutoJsMat()
|
val mat = AutoJsMat()
|
||||||
@@ -590,7 +590,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun rotate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..4) {
|
fun rotate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..4) {
|
||||||
val (o, degree, centerXArg, centerYArg) = it
|
val (o, degree, centerXArg, centerYArg) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.rotate must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.rotate must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val centerX = parseNumber(centerXArg) { image.width / 2 }.toFloat()
|
val centerX = parseNumber(centerXArg) { image.width / 2 }.toFloat()
|
||||||
@@ -602,9 +602,9 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun concat(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
fun concat(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (oA, oB, direction) = it
|
val (oA, oB, direction) = it
|
||||||
val imageA = if (oA is String) read(scriptRuntime, arrayOf(oA, true)) else oA
|
val imageA = if (oA is String) read(scriptRuntime, arrayOf<Any>(oA, true)) else oA
|
||||||
require(imageA is ImageWrapper) { "Argument imageA for images.concat must be a ImageWrapper" }
|
require(imageA is ImageWrapper) { "Argument imageA for images.concat must be a ImageWrapper" }
|
||||||
val imageB = if (oB is String) read(scriptRuntime, arrayOf(oB, true)) else oB
|
val imageB = if (oB is String) read(scriptRuntime, arrayOf<Any>(oB, true)) else oB
|
||||||
require(imageB is ImageWrapper) { "Argument imageB for images.concat must be a ImageWrapper" }
|
require(imageB is ImageWrapper) { "Argument imageB for images.concat must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
ApiImages.concat(imageA, imageB, directionToGravityToConcat(direction))
|
ApiImages.concat(imageA, imageB, directionToGravityToConcat(direction))
|
||||||
@@ -614,7 +614,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun detectColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 4..6) {
|
fun detectColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 4..6) {
|
||||||
val (o, color, x, y, threshold, algorithm) = it
|
val (o, color, x, y, threshold, algorithm) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.detectColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.detectColor must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val pixel = pixel(scriptRuntime, arrayOf(image, coerceIntNumber(x), coerceIntNumber(y)))
|
val pixel = pixel(scriptRuntime, arrayOf(image, coerceIntNumber(x), coerceIntNumber(y)))
|
||||||
@@ -628,7 +628,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun detectsColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 4..6) {
|
fun detectsColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 4..6) {
|
||||||
val (o) = it
|
val (o) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.detectsColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.detectsColor must be a ImageWrapper" }
|
||||||
detectColor(scriptRuntime, it)
|
detectColor(scriptRuntime, it)
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun detectsMultiColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 5..6) {
|
fun detectsMultiColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 5..6) {
|
||||||
val (o, _, _, _, paths) = it
|
val (o, _, _, _, paths) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.detectMultiColors must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.detectMultiColors must be a ImageWrapper" }
|
||||||
require(paths is NativeArray) { "Argument paths for images.detectMultiColors must be a JavaScript Array" }
|
require(paths is NativeArray) { "Argument paths for images.detectMultiColors must be a JavaScript Array" }
|
||||||
detectMultiColors(scriptRuntime, it)
|
detectMultiColors(scriptRuntime, it)
|
||||||
@@ -657,7 +657,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointByColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) { argList ->
|
fun findPointByColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) { argList ->
|
||||||
val (o, color, xOrOptions, y, width, height, threshold) = argList
|
val (o, color, xOrOptions, y, width, height, threshold) = argList
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointByColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointByColor must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val opt = when {
|
val opt = when {
|
||||||
@@ -681,7 +681,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..3) {
|
fun findColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, color, options) = it
|
val (o, color, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findColor must be a ImageWrapper" }
|
||||||
findPointByColor(scriptRuntime, arrayOf(image, color, options))
|
findPointByColor(scriptRuntime, arrayOf(image, color, options))
|
||||||
}
|
}
|
||||||
@@ -691,7 +691,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findColorInRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) {
|
fun findColorInRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) {
|
||||||
val (o) = it
|
val (o) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findColorInRegion must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findColorInRegion must be a ImageWrapper" }
|
||||||
findPointByColor(scriptRuntime, it)
|
findPointByColor(scriptRuntime, it)
|
||||||
}
|
}
|
||||||
@@ -700,7 +700,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointByColorExactly(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..6) {
|
fun findPointByColorExactly(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..6) {
|
||||||
val (o) = it
|
val (o) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointByColorExactly must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointByColorExactly must be a ImageWrapper" }
|
||||||
findPointByColor(scriptRuntime, it + /* threshold = */ 0)
|
findPointByColor(scriptRuntime, it + /* threshold = */ 0)
|
||||||
}
|
}
|
||||||
@@ -710,7 +710,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findColorEquals(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..6) {
|
fun findColorEquals(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..6) {
|
||||||
val (o) = it
|
val (o) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findColorEquals must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findColorEquals must be a ImageWrapper" }
|
||||||
findPointByColorExactly(scriptRuntime, it)
|
findPointByColorExactly(scriptRuntime, it)
|
||||||
}
|
}
|
||||||
@@ -719,7 +719,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointsByColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 2..3) {
|
fun findPointsByColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, color, options) = it
|
val (o, color, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointsByColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointsByColor must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
val opt = options as? NativeObject ?: newNativeObject()
|
val opt = options as? NativeObject ?: newNativeObject()
|
||||||
@@ -736,7 +736,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findAllPointsForColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 2..3) {
|
fun findAllPointsForColor(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o) = it
|
val (o) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findAllPointsForColor must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findAllPointsForColor must be a ImageWrapper" }
|
||||||
findPointsByColor(scriptRuntime, it)
|
findPointsByColor(scriptRuntime, it)
|
||||||
}
|
}
|
||||||
@@ -745,7 +745,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointByColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 3..4) {
|
fun findPointByColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 3..4) {
|
||||||
val (o, firstColor, paths, options) = it
|
val (o, firstColor, paths, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointByColors must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointByColors must be a ImageWrapper" }
|
||||||
require(paths is NativeArray) { "Argument paths for images.findPointByColors must be a JavaScript Array" }
|
require(paths is NativeArray) { "Argument paths for images.findPointByColors must be a JavaScript Array" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -767,7 +767,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findMultiColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 3..4) {
|
fun findMultiColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 3..4) {
|
||||||
val (o, _, paths) = it
|
val (o, _, paths) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findMultiColors must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findMultiColors must be a ImageWrapper" }
|
||||||
require(paths is NativeArray) { "Argument paths for images.findMultiColors must be a JavaScript Array" }
|
require(paths is NativeArray) { "Argument paths for images.findMultiColors must be a JavaScript Array" }
|
||||||
findPointByColors(scriptRuntime, it)
|
findPointByColors(scriptRuntime, it)
|
||||||
@@ -777,7 +777,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointsByColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 3..4) {
|
fun findPointsByColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeArray = ensureArgumentsLengthInRange(args, 3..4) {
|
||||||
val (o, firstColor, paths, options) = it
|
val (o, firstColor, paths, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointsByColors must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointsByColors must be a ImageWrapper" }
|
||||||
require(paths is NativeArray) { "Argument paths for images.findPointsByColors must be a JavaScript Array" }
|
require(paths is NativeArray) { "Argument paths for images.findPointsByColors must be a JavaScript Array" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -798,7 +798,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findPointByImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) { argList ->
|
fun findPointByImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) { argList ->
|
||||||
val (o, template, xOrOptions, y, width, height, thresholdArg) = argList
|
val (o, template, xOrOptions, y, width, height, thresholdArg) = argList
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findPointByImage must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findPointByImage must be a ImageWrapper" }
|
||||||
require(template is ImageWrapper) { "Argument template for images.findPointByImage must be a ImageWrapper" }
|
require(template is ImageWrapper) { "Argument template for images.findPointByImage must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -829,7 +829,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..3) {
|
fun findImage(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, template) = it
|
val (o, template) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findImage must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findImage must be a ImageWrapper" }
|
||||||
require(template is ImageWrapper) { "Argument template for images.findImage must be a ImageWrapper" }
|
require(template is ImageWrapper) { "Argument template for images.findImage must be a ImageWrapper" }
|
||||||
findPointByImage(scriptRuntime, it)
|
findPointByImage(scriptRuntime, it)
|
||||||
@@ -840,7 +840,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun findImageInRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) {
|
fun findImageInRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvPoint? = ensureArgumentsLengthInRange(args, 2..7) {
|
||||||
val (o, template) = it
|
val (o, template) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.findImageInRegion must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.findImageInRegion must be a ImageWrapper" }
|
||||||
require(template is ImageWrapper) { "Argument template for images.findImageInRegion must be a ImageWrapper" }
|
require(template is ImageWrapper) { "Argument template for images.findImageInRegion must be a ImageWrapper" }
|
||||||
findPointByImage(scriptRuntime, it)
|
findPointByImage(scriptRuntime, it)
|
||||||
@@ -850,7 +850,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun matchTemplate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): MatchingResult = ensureArgumentsLengthInRange(args, 2..3) {
|
fun matchTemplate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): MatchingResult = ensureArgumentsLengthInRange(args, 2..3) {
|
||||||
val (o, template, options) = it
|
val (o, template, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.matchTemplate must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.matchTemplate must be a ImageWrapper" }
|
||||||
require(template is ImageWrapper) { "Argument template for images.matchTemplate must be a ImageWrapper" }
|
require(template is ImageWrapper) { "Argument template for images.matchTemplate must be a ImageWrapper" }
|
||||||
initOpenCvIfNeeded()
|
initOpenCvIfNeeded()
|
||||||
@@ -878,7 +878,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun toBase64(scriptRuntime: ScriptRuntime, args: Array<out Any?>): String = ensureArgumentsLengthInRange(args, 1..3) {
|
fun toBase64(scriptRuntime: ScriptRuntime, args: Array<out Any?>): String = ensureArgumentsLengthInRange(args, 1..3) {
|
||||||
val (o, format, quality) = it
|
val (o, format, quality) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.toBase64 must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.toBase64 must be a ImageWrapper" }
|
||||||
scriptRuntime.images.toBase64(image, parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_TO_BASE64_QUALITY))
|
scriptRuntime.images.toBase64(image, parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_TO_BASE64_QUALITY))
|
||||||
}
|
}
|
||||||
@@ -897,7 +897,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun toBytes(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ByteArray = ensureArgumentsLengthInRange(args, 1..3) {
|
fun toBytes(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ByteArray = ensureArgumentsLengthInRange(args, 1..3) {
|
||||||
val (o, format, quality) = it
|
val (o, format, quality) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.toBytes must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.toBytes must be a ImageWrapper" }
|
||||||
scriptRuntime.images.toBytes(image, parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_TO_BYTES_QUALITY))
|
scriptRuntime.images.toBytes(image, parseImageFormat(format), parseQuality(quality, DEFAULT_IMAGE_TO_BYTES_QUALITY))
|
||||||
}
|
}
|
||||||
@@ -933,7 +933,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun detectAndComputeFeatures(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageFeatures = ensureArgumentsLengthInRange(args, 1..2) {
|
fun detectAndComputeFeatures(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageFeatures = ensureArgumentsLengthInRange(args, 1..2) {
|
||||||
val (o, options) = it
|
val (o, options) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.detectAndComputeFeatures must be a ImageWrapper instead of ${image.jsBrief()}" }
|
require(image is ImageWrapper) { "Argument image for images.detectAndComputeFeatures must be a ImageWrapper instead of ${image.jsBrief()}" }
|
||||||
val opt = fillDetectAndComputeFeaturesOptions(image.height, image.width, options as? NativeObject ?: newNativeObject())
|
val opt = fillDetectAndComputeFeaturesOptions(image.height, image.width, options as? NativeObject ?: newNativeObject())
|
||||||
val rect = buildRegionInternal(image, opt.region)
|
val rect = buildRegionInternal(image, opt.region)
|
||||||
@@ -1005,7 +1005,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun compress(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 2) {
|
fun compress(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageWrapper = ensureArgumentsLength(args, 2) {
|
||||||
val (o, compressLevelArg) = it
|
val (o, compressLevelArg) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.compress must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.compress must be a ImageWrapper" }
|
||||||
val compressLevel = coerceNumber(compressLevelArg, 1.0)
|
val compressLevel = coerceNumber(compressLevelArg, 1.0)
|
||||||
val level = 2.0.pow(floor(ln(compressLevel.coerceAtLeast(1.0)) / ln(2.0))).toInt()
|
val level = 2.0.pow(floor(ln(compressLevel.coerceAtLeast(1.0)) / ln(2.0))).toInt()
|
||||||
@@ -1063,7 +1063,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun buildRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvRect = ensureArgumentsLength(args, 2) {
|
fun buildRegion(scriptRuntime: ScriptRuntime, args: Array<out Any?>): OpencvRect = ensureArgumentsLength(args, 2) {
|
||||||
val (o, region) = it
|
val (o, region) = it
|
||||||
val image = if (o is String) read(scriptRuntime, arrayOf(o, true)) else o
|
val image = if (o is String) read(scriptRuntime, arrayOf<Any>(o, true)) else o
|
||||||
require(image is ImageWrapper) { "Argument image for images.buildRegion must be a ImageWrapper" }
|
require(image is ImageWrapper) { "Argument image for images.buildRegion must be a ImageWrapper" }
|
||||||
require(region.isJsNullish() || region.isJsArray() || region is OpencvRect || region is AndroidRect) {
|
require(region.isJsNullish() || region.isJsArray() || region is OpencvRect || region is AndroidRect) {
|
||||||
"Argument region ${region.jsSpecies()} is invalid for images.buildRegion"
|
"Argument region ${region.jsSpecies()} is invalid for images.buildRegion"
|
||||||
@@ -1111,9 +1111,9 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun isEqual(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLength(args, 2) { argList ->
|
fun isEqual(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLength(args, 2) { argList ->
|
||||||
val (oA, oB) = argList
|
val (oA, oB) = argList
|
||||||
val imageA = if (oA is String) read(scriptRuntime, arrayOf(oA, true)) else oA
|
val imageA = if (oA is String) read(scriptRuntime, arrayOf<Any>(oA, true)) else oA
|
||||||
require(imageA is ImageWrapper) { throw WrappedIllegalArgumentException("The first image argument for images.isEqual must be a ImageWrapper instead of ${imageA.jsBrief()}") }
|
require(imageA is ImageWrapper) { throw WrappedIllegalArgumentException("The first image argument for images.isEqual must be a ImageWrapper instead of ${imageA.jsBrief()}") }
|
||||||
val imageB = if (oB is String) read(scriptRuntime, arrayOf(oB, true)) else oB
|
val imageB = if (oB is String) read(scriptRuntime, arrayOf<Any>(oB, true)) else oB
|
||||||
require(imageB is ImageWrapper) { throw WrappedIllegalArgumentException("The second image argument for images.isEqual must be a ImageWrapper instead of ${imageA.jsBrief()}") }
|
require(imageB is ImageWrapper) { throw WrappedIllegalArgumentException("The second image argument for images.isEqual must be a ImageWrapper instead of ${imageA.jsBrief()}") }
|
||||||
ImageSimilarity.isEqual(imageA.mat, imageB.mat)
|
ImageSimilarity.isEqual(imageA.mat, imageB.mat)
|
||||||
}
|
}
|
||||||
@@ -1399,13 +1399,13 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
|
|||||||
val matA = when (imageA) {
|
val matA = when (imageA) {
|
||||||
is ImageWrapper -> imageA.bgrMat
|
is ImageWrapper -> imageA.bgrMat
|
||||||
is OpencvMat -> imageA
|
is OpencvMat -> imageA
|
||||||
is String -> read(scriptRuntime, arrayOf(imageA, true))!!.bgrMat
|
is String -> read(scriptRuntime, arrayOf<Any>(imageA, true))!!.bgrMat
|
||||||
else -> throw WrappedIllegalArgumentException("The first image argument for images.$funcName must be a ImageWrapper or a Mat instead of ${imageA.jsBrief()}")
|
else -> throw WrappedIllegalArgumentException("The first image argument for images.$funcName must be a ImageWrapper or a Mat instead of ${imageA.jsBrief()}")
|
||||||
}
|
}
|
||||||
val matB = when (imageB) {
|
val matB = when (imageB) {
|
||||||
is ImageWrapper -> imageB.bgrMat
|
is ImageWrapper -> imageB.bgrMat
|
||||||
is OpencvMat -> imageB
|
is OpencvMat -> imageB
|
||||||
is String -> read(scriptRuntime, arrayOf(imageB, true))!!.bgrMat
|
is String -> read(scriptRuntime, arrayOf<Any>(imageB, true))!!.bgrMat
|
||||||
else -> throw WrappedIllegalArgumentException("The second image argument for images.$funcName must be a ImageWrapper or a Mat instead of ${imageB.jsBrief()}")
|
else -> throw WrappedIllegalArgumentException("The second image argument for images.$funcName must be a ImageWrapper or a Mat instead of ${imageB.jsBrief()}")
|
||||||
}
|
}
|
||||||
return matA to matB
|
return matA to matB
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class Shell(private val scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntim
|
|||||||
if (!RootUtils.isRootAvailable()) return@ensureArgumentsOnlyOne false
|
if (!RootUtils.isRootAvailable()) return@ensureArgumentsOnlyOne false
|
||||||
when (val packageName = App.getPackageName(scriptRuntime, arrayOf(app))) {
|
when (val packageName = App.getPackageName(scriptRuntime, arrayOf(app))) {
|
||||||
null -> false
|
null -> false
|
||||||
else -> execCommand(scriptRuntime, arrayOf("am force-stop $packageName", true)).code == 0
|
else -> execCommand(scriptRuntime, arrayOf<Any>("am force-stop $packageName", true)).code == 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,25 +226,17 @@ class ManageKeyStoreActivity : BaseActivity() {
|
|||||||
configs: VerifyKeyStoreDialog.VerifyKeyStoreConfigs, keyStore: KeyStore,
|
configs: VerifyKeyStoreDialog.VerifyKeyStoreConfigs, keyStore: KeyStore,
|
||||||
) {
|
) {
|
||||||
// 验证密钥库密码
|
// 验证密钥库密码
|
||||||
val tmpKeyStore = try {
|
val tmpKeyStore = runCatching {
|
||||||
KeyStoreHelper.loadKeyStore(File(keyStore.absolutePath), configs.password.toCharArray())
|
KeyStoreHelper.loadKeyStore(File(keyStore.absolutePath), configs.password.toCharArray())
|
||||||
} catch (e: Exception) {
|
}.getOrElse {
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmpKeyStore == null) {
|
|
||||||
showToast(R.string.text_verify_failed)
|
showToast(R.string.text_verify_failed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证别名和别名密码
|
// 验证别名和别名密码
|
||||||
val tmpKey = try {
|
runCatching {
|
||||||
tmpKeyStore.getKey(configs.alias, configs.aliasPassword.toCharArray())
|
tmpKeyStore.getKey(configs.alias, configs.aliasPassword.toCharArray())
|
||||||
} catch (e: Exception) {
|
}.getOrElse {
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmpKey == null) {
|
|
||||||
showToast(R.string.text_verify_failed)
|
showToast(R.string.text_verify_failed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
#Thu Mar 13 17:43:40 CST 2025
|
#Fri Mar 14 19:50:02 CST 2025
|
||||||
BUILD_TIME=1741859020501
|
BUILD_TIME=1741953002410
|
||||||
COMPILE_SDK_VERSION=35
|
COMPILE_SDK_VERSION=35
|
||||||
JAVA_VERSION=23
|
JAVA_VERSION=23
|
||||||
JAVA_VERSION_MIN_RADICAL=0
|
JAVA_VERSION_MIN_RADICAL=0
|
||||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=35
|
TARGET_SDK_VERSION=35
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=3025
|
VERSION_BUILD=3029
|
||||||
VERSION_NAME=6.6.2 Alpha4
|
VERSION_NAME=6.6.2 Alpha4
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
Reference in new issue
Block a user