On Oct 20, 2014, at 8:50 AM, Leonardo <mac.iphone....@gmail.com> wrote:

> I fill my bezierPath (a simple rect) with a red color.
> Then I stroke it with a 10 point border with a 50% transparent gray color.
> Since the border of the path gets drawn 50% inside the path and 50% outside
> the path, I end up with an external 5 points 50% gray border and an internal
> 5 points red-gray border. That's really bad.
> 
> I really need to fill the rect with flat red and stroke it with a 10
> points-width 50% transparent gray border.
> 
> If I draw 2 paths, the one to be filled with red and the one to be stroked
> with gray, I end up with a small white gap between the 2 paths.

Show what you tried for this last part, because that's probably the best 
approach.  You would inset the rect by half of the stroke width.  Fill that 
inset rect and stroke the original rect.

Another approach would be to clip both drawing operations against the same 
path, except inverted in one case.  To invert the clipping you would append a 
rectangle path much larger than the drawing so you have a rectangle in a 
rectangle.  Set the winding rule to NSEvenOddWindingRule and that makes the 
interior of the inner rectangle excluded from the path.  Don't forget to save 
and restore the graphics context state around changes to the clipping region as 
that's the only way to revert a clipping operation.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to