Hullaballoonatic
09/10/2018, 11:43 PMval bb = terrain!![posRed + 1] and 0xff.toByte()
val gg = terrain[posRed + 2] and 0xff.toByte()
val rr = terrain[posRed + 3] and 0xff.toByte()
g.color = Color(rr.toInt(), gg.toInt(), bb.toInt())
ilya.gorbunov
09/10/2018, 11:56 PMbb
, gg
and rr
still having Byte
type and that type is signed: it ranges from -128 to 127. The negative values are outside of the color component range when you convert them to int.Hullaballoonatic
09/10/2018, 11:57 PMilya.gorbunov
09/10/2018, 11:57 PMval rr = terrain[posRed + 1].toInt() and 0xFF
...
g.color = Color(rr, gg, bb)
Hullaballoonatic
09/10/2018, 11:57 PMHullaballoonatic
09/10/2018, 11:57 PMValV
09/11/2018, 12:20 AMByte and Byte
did not work for me, while Byte.and(Byte)
did. Anyway constructor Color(Byte, Byte, Byte)
was not found