ColorMask enumeration

Gives the bit mask that selects a channel of an ARGB value.

Each mask is &HFF shifted left by the matching member of ColorShift. No public member takes or returns this enumeration.

Note 0.9.45.0

AlphaMask has the sign bit set, so shifting the masked value right by AlphaShift copies the sign bit and gives -1 for an alpha of 255. Mask the result with &HFF again, or use the Alpha property of a Color.

Member Value Description
AlphaMask &HFF000000 Selects the alpha channel.
RedMask &H00FF0000 Selects the red channel.
GreenMask &H0000FF00 Selects the green channel.
BlueMask &H000000FF Selects the blue channel.

Example

Dim argb As Long = CColor.Orange
Debug.Print (argb And RedMask) >> RedShift
Debug.Print (argb And GreenMask) >> GreenShift
Debug.Print (argb And BlueMask) >> BlueShift
Debug.Print (argb And AlphaMask) >> AlphaShift
Debug.Print ((argb And AlphaMask) >> AlphaShift) And &HFF
' Output:
' 255
' 165
' 0
' -1
' 255

See Also