It's hard to say from what's here exactly what's going on. In the third picture (based on your code) you're drawing opaque, black strokes around a clear fill into the mask, so when you use that as a mask, only the areas you stroked will be "visible" from the gradient layer (the hint that these are strokes only is that you can see the stroke miters). When you change clearColor to whiteColor (which is opaque), the area inside the path also becomes visible from the gradient layer (the hint to this is that the lines appear fatter owing to the fact that the stroke runs along the middle of the path, thus "fattening" the fill. Also the stroke miters are no longer visible because they've been occluded by the fill.)
In a mask layer, the color is irrelevant -- it's the alpha channel (opacity) that matters. This is why whiteColor vs. blackColor makes no difference. They both have an alpha value of 1.0, whereas clearColor has an alpha value of 0.0. From the header:
/* A layer whose alpha channel is used as a mask to select between the
* layer's background and the result of compositing the layer's
* contents with its filtered background. Defaults to nil. When used as
* a mask the layer's `compositingFilter' and `backgroundFilters'
* properties are ignored. When setting the mask to a new layer, the
* new layer must have a nil superlayer, otherwise the behavior is
* undefined. */
@property(retain) CALayer *mask;
This is why you no longer see the stroke miters in the fourth image -- they're being hidden by the fact that the mask only looks at the alpha channel and regardless of color hue (i.e. white or black) they both paint with an alpha of 1.0.
Again, it's not clear exactly what you're trying to do here in the end, but your use of whiteColor feels like a red herring. If your goal is something that looks like the second image, you probably want your mask layer to have no stroke and an opaque fill, as in:
gradientMask.fillColor = [[UIColor blackColor] CGColor];
gradientMask.strokeColor = [[UIColor clearColor] CGColor];