Skip to content

Commit

Permalink
Add simple constructor for color
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Mar 1, 2025
1 parent ac2fb8a commit 171f484
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ class Color(
val WHITE = Color(0xFFFFFFFF.toInt())
}

constructor(
alpha: Int,
red: Int,
green: Int,
blue: Int
) : this(alpha shl 24 or (red shl 16) or (green shl 8) or blue)


val alpha: Int get() = (color shr 24) and 0xFF
val red: Int get() = (color shr 16) and 0xFF
val green: Int get() = (color shr 8) and 0xFF
Expand Down

0 comments on commit 171f484

Please # to comment.