Regarding ARGB colour packing and depacking, the math just boils down some shifts and masks, the same goes for pulling nibbles and bits etc
NOTE: mock up code
MyColour = rgb(255,50,100,200) ; Assuming colour levels are in A,R,G,B order.. They can be in in order but R,G,B,A is likely
A = ( MyColour >>24) and 255
R = ( MyColour >>16) and 255
G = ( MyColour >> 8) and 255
B = ( MyColour >>0) and 255 ; The shift here isn't needed here
Masking A would only be needed with the shift is arthimetic, which it shouldn't be in AGK
To roll your own RGB function we mask the inputs and then shift and OR into position, you can use addition also.
Function MyRGB(A,R,G,B)
NewColour = ((A and 255) << 24) or ((R and 255) << 16) or ((A and 255) << 8) or (A and 255 )
EndFunction NewColour