diff --git a/gradle.properties b/gradle.properties index 84367f4..9591e4b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/kotlin/ru/dbotthepony/kommons/math/RGBAColor.kt b/src/main/kotlin/ru/dbotthepony/kommons/math/RGBAColor.kt index 47d703d..3088ec1 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/math/RGBAColor.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/math/RGBAColor.kt @@ -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