cocoa - Matt Gemmell's NSBezierPath+StrokeExtensions draws outside of clip rect -
I am using Matt JeML's NSBZear path + stroke extension range so that an internal stroke can occur on NSRact. Here is the code for the whole range:
- (zero) StrokeInces {/ * stroke is using without any extra clipping rectangle. * / [Self stroke instantly: nssarrite]; } - (Zero) StrokeInsideDihine: (NSRact) ClipRark {NSGFix Context * This Context = [NSGFix Contact ContentContacts]; Float linewidth = [self linewidth]; / * Save Current Graphics Reference * / [This Contact SegraphicsState]; / * Double the width of the stroke, since the stroke is a stroke on the center path. * / [Self set linewidth: (linewidth * 2.0)]; / * Clip clip on this path; Do not remove anything outside the route * / [self setclip]; / * More clip drawing for clip clipping, usually the frame of the scene * / If (clipRect.size.width> 0.0 & amp; clipRect.size.height & gt; 0.0) {[NSBZairpath clip: clip opinion ]; } / * stroke path. * / [Self stroke]; / * Restore previous graphics references * / [thisContext reinstallGraphicsState]; [Self setlinewidth: linewidth]; } << Code> Method: - (zero) Direct: (NSRICT) dirty look {nsrified myRect = NSMakeRect (500, 0, 400, 100); [[Ensolar color with-silicated red: 0 green: 0 blue: 1.0 alpha: 0.5] set]; NSRectFillUsingOperation (myRect, NSCompositeSourceOver); [[Enkolar blue color] set]; [[NSBZearpath BijierPathvithrect: MyRect] StrokeInstead]; } However, when I scroll it happens:
As you can see, the inner stroke pulls over the toolbar. Why does this happen How can I fix the strokeInside method? Note that this does not happen with the regular stroke method.
Okay, I got it. Instead of this line:
[self setclip]; Use this:
[self addClip]; Works fine and makes sense.
Comments
Post a Comment