ASMR/src/main/kotlin/net/shadowfacts/cacao/util/Color.kt

19 lines
489 B
Kotlin
Raw Normal View History

2019-06-22 19:02:17 +00:00
package net.shadowfacts.cacao.util
2019-06-21 20:22:23 +00:00
2019-06-22 14:59:18 +00:00
/**
* @author shadowfacts
*/
2019-06-21 20:22:23 +00:00
data class Color(val red: Int, val green: Int, val blue: Int, val alpha: Int = 255) {
constructor(rgb: Int, alpha: Int = 255): this(rgb shr 16, (rgb shr 8) and 255, rgb and 255, alpha)
val argb: Int
get() = ((alpha and 255) shl 24) or ((red and 255) shl 16) or ((green and 255) shl 8) or (blue and 255)
2019-06-22 14:56:12 +00:00
companion object {
val CLEAR = Color(0, alpha = 0)
val WHITE = Color(0xffffff)
val BLACK = Color(0)
}
2019-06-21 20:22:23 +00:00
}