I use this when I use the LibGdx addon for B4A, I think it is the same. B4A has a few different ways to symbolize colours though.
Notice how the Alpha is a bit different place than usually, this might be Libgdx so just swap it with blue byte. I use RGBA 8888 btw.
Hope it helps!
B4X:
' Dim argb As Int = pixelcolor
' Dim Alpha As Int = Bit.ShiftRight(Bit.And(argb, 0xff000000), 24)
' alpha = Bit.ShiftRight(argb, 24)
' alpha = Bit.And(alpha, 0xff)
' red = Bit.ShiftRight(Bit.And(argb, 0x00ff0000), 16)
' green = Bit.ShiftRight(Bit.And(argb, 0x0000ff00), 8)
' blue = Bit.And(argb, 0x000000ff)
Converts hex color strings to a color int value and vice versa: Private Sub ColorToHex(clr As Int) As String Dim bc As ByteConverter Return bc.HexFromBytes(bc.IntsToBytes(Array As Int(clr))) End Sub Private Sub HexToColor(Hex As String) As Int Dim bc As ByteConverter If...
www.b4x.com
+
B4X:
'int ot argb
Private Sub GetARGB(Color As Int) As Int()'ignore
Private res(4) As Int
res(0) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff000000), 24)
res(1) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff0000), 16)
res(2) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff00), 8)
res(3) = Bit.And(Color, 0xff)
Return res
End Sub