Code: Select all
Example:
RGB = (11, 12, 13)
Draft format:
1095401999616
Hex:
??RRGGBBAA
ff0b0c0d00
Default format:
185339391
Hex:
??RRGGBBAA
000b0c0dff
Code: Select all
Example:
RGB = (11, 12, 13)
Draft format:
1095401999616
Hex:
??RRGGBBAA
ff0b0c0d00
Default format:
185339391
Hex:
??RRGGBBAA
000b0c0dff
Code: Select all
def argb_to_rgba(color):
"""Change byte order of a 4 byte color int from ARGB (Qt) to RGBA."""
return ((color & 0xFFFFFF) << 8) + (color >> 24)
def rgba_to_argb(color):
"""Change byte order of a 4 byte color int from RGBA to ARGB (Qt)."""
return (color >> 8) + ((color & 0xFF) << 24)
Hmm indeed it's possible that I forgot that bit...