Sub mixColors(col1 As Int, col2 As Int) As Int
Dim r1, g1, b1, r2, g2, b2, r3 ,g3, b3 As Int
r1 = Bit.UnsignedShiftRight(Bit.And(col1, 0xff0000), 16)
g1 = Bit.UnsignedShiftRight(Bit.And(col1, 0xff00), 8)
b1 = Bit.And(col1, 0xff)
r2 = Bit.UnsignedShiftRight(Bit.And(col2, 0xff0000), 16)
g2 = Bit.UnsignedShiftRight(Bit.And(col2, 0xff00), 8)
b2 = Bit.And(col2, 0xff)
r3 = (r1 + r2)/2
g3 = (g1 + g2)/2
b3 = (b1 + b2)/2
Return Colors.RGB(r3, g3, b3)
End Sub