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:
parent
a2e7b48501
commit
beeabe17c4
1 changed files with 2 additions and 1 deletions
|
@ -206,7 +206,8 @@ object ImageUtil {
|
||||||
|
|
||||||
fun Boolean.toInt() = if (this) 1 else 0
|
fun Boolean.toInt() = if (this) 1 else 0
|
||||||
private fun isDark(color: Int): Boolean {
|
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 {
|
private fun pixelIsClose(color1: Int, color2: Int): Boolean {
|
||||||
|
|
Reference in a new issue