[FIXED] Schneiden Sie ein Rechteck aus einem NSBezierPath aus

Ausgabe

Ist es möglich, einen Teil davon zu entfernen NSBezierPath, der durch eine NSRectRegion innerhalb des Pfads definiert ist?

Lösung

Unbedingt. Dies ist, was Clipping-Bereiche tun:

// Save the current clipping region
[NSGraphicsContext saveGraphicsState];
NSRect dontDrawThisRect = NSMakeRect(x, y, w, h);
// Either:
NSRectClip(dontDrawThisRect);
// Or (usually for more complex shapes):
//[[NSBezierPath bezierPathWithRect:dontDrawThisRect] addClip];
[myBezierPath fill];    // or stroke, or whatever you do
// Restore the clipping region for further drawing
[NSGraphicsContext restoreGraphicsState];


Beantwortet von –
jscs


Antwort geprüft von –
Willingham (FixError Volunteer)

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like