Checking alpha component when check if a color is dark

Because turns out some scanalors leave an uncropped alpha in their pages
This commit is contained in:
Jay 2020-04-20 01:48:31 -04:00
parent a2e7b48501
commit beeabe17c4

View File

@ -206,7 +206,8 @@ object ImageUtil {
fun Boolean.toInt() = if (this) 1 else 0
private fun isDark(color: Int): Boolean {
return Color.red(color) < 40 && Color.blue(color) < 40 && Color.green(color) < 40
return Color.red(color) < 40 && Color.blue(color) < 40 && Color.green(color) < 40 &&
Color.alpha(color) > 200
}
private fun pixelIsClose(color1: Int, color2: Int): Boolean {