In this B4A post:
https://www.b4x.com/android/forum/threads/get-alpha-red-green-blue.7258/#post-41502
Erel supplies this code to extract RGB from an Android pixel:
If you run similar code in B4I it does not work correctly - I suspect some sort of endian problem - the A is at least where the B was - or at least seems to be some of the time.
What is the correct equivalent for an iOS pixel?
Thanks in anticipation...
https://www.b4x.com/android/forum/threads/get-alpha-red-green-blue.7258/#post-41502
Erel supplies this code to extract RGB from an Android pixel:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim argb() As Int
argb = GetARGB(Colors.Transparent)
Log("A = " & argb(0))
Log("R = " & argb(1))
Log("G = " & argb(2))
Log("B = " & argb(3))
End Sub
Sub GetARGB(Color As Int) As Int()
Dim 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
If you run similar code in B4I it does not work correctly - I suspect some sort of endian problem - the A is at least where the B was - or at least seems to be some of the time.
What is the correct equivalent for an iOS pixel?
Thanks in anticipation...
Last edited: