views:

121

answers:

1

Is it possible to adjust the alignment, from the default centered, of a stroke when using kCGPathFillStroke as the drawing mode?

For example, when drawing a closed path using:

CGContextDrawPath(context, kCGPathFillStroke);

The stroke lies 50% outside/50% inside the drawn path. The stroke color has a non-opaque alpha so the net effect is undesirable. I want the stroke to lie either all inside or outside.

The only potential way I see of doing this is to rebuild the path, contracted by 50% of the stroke width.

A: 

Your guess is correct. Adjust the path's position.

NSResponder