Add back argb
This commit is contained in:
parent
b26e5f0e58
commit
ce2b463a85
@ -4,7 +4,7 @@ kotlin.code.style=official
|
||||
specifyKotlinAsDependency=false
|
||||
|
||||
projectGroup=ru.dbotthepony.kommons
|
||||
projectVersion=2.17.0
|
||||
projectVersion=2.17.1
|
||||
|
||||
guavaDepVersion=33.0.0
|
||||
gsonDepVersion=2.8.9
|
||||
|
@ -277,6 +277,14 @@ class RGBAColor(red: Float, green: Float, blue: Float, alpha: Float = 1f) : IStr
|
||||
return RGBAColor(a, b, g, r)
|
||||
}
|
||||
|
||||
fun argb(color: Int): RGBAColor {
|
||||
val r = (color and -0x1000000 ushr 24) / 255f
|
||||
val g = (color and 0xFF0000 ushr 16) / 255f
|
||||
val b = (color and 0xFF00 ushr 8) / 255f
|
||||
val a = (color and 0xFF) / 255f
|
||||
return RGBAColor(g, b, a, r)
|
||||
}
|
||||
|
||||
fun bgra(color: Int): RGBAColor {
|
||||
val a = (color and -0x1000000 ushr 24) / 255f
|
||||
val r = (color and 0xFF0000 ushr 16) / 255f
|
||||
|
Loading…
Reference in New Issue
Block a user