compareBitmapColors

abstract fun compareBitmapColors(image: Bitmap, firstColor: String, x: Int, y: Int, similarity: Int?, config: CompareColorsConfig.() -> Unit): Boolean

比较 Bitmap 中指定坐标的颜色是否匹配目标颜色。

这是 compareColors 的内存版本,直接在 Bitmap 对象上进行颜色比较,性能更高。

Return

true 表示所有指定坐标的颜色均匹配,false 表示存在不匹配。

Parameters

image

待分析的 Bitmap 对象。

firstColor

目标主颜色,支持 RGB 和 ARGB 格式。

x

主坐标的横坐标(像素单位)。

y

主坐标的纵坐标(像素单位)。

similarity

主颜色相似度阈值(0-100),null 使用默认值。

config

颜色比较配置构建器。

See also

了解更多配置选项。

Throws

当参数无效、颜色格式错误或 Bitmap 无效时抛出。