What we’re doing is taking a 4 byte unsigned long, and using it for a 32-bit color value.
ARGB — One byte for Alpha, Red, Green, Blue.
Now in hex, those 4 bytes are represented by 8 hex-characters, from 00 to FF (0 to 255)
_RGB(r,g,b) gives us a 3-byte value for color, without an alpha channel. Since there’s no such thing as a 3-byte long, the value is actually 0RGB — One byte for zero alpha, then a byte for Red, Green, Blue.
Now, when you take a 4-byte ARGB value AND it with a 0RGB value, the result will always be a 0RGB value. (You stripped out the alpha with the 0 you ANDed it against.). IF the result is the same 0RGB value that you ANDed against, then you have a perfect color match (minus alpha, of course). This means that anything from 0 alpha to 255 alpha would be a match, as long as the RGB values match.
IF they do match, we simply set that pixel’s value to the 0RGB value (without any alpha value), and then we move on to the next pixel.
And that’s clearcolor in a nutshell.