You may also use bitshift operations, I don't know if they're faster, but in theory they should be:
rgb=readpixelfast(x,y) and $FFFFFF
r=(rgb shr 16) and $FF
g=(rgb shr 8) and $FF
b= rgb and $FF
and the other way:
argb= (alpha shl 24) or (r shl 16) or (g shl 8) or b
rgb=readpixelfast(x,y) and $FFFFFF
r=(rgb shr 16) and $FF
g=(rgb shr 8) and $FF
b= rgb and $FF
and the other way:
argb= (alpha shl 24) or (r shl 16) or (g shl 8) or b