gdi32: Add a common helper for computing pen and brush masks.