Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top