2016-12-19 2 views
0

NSBezierPath addClipを使用すると、クリッピングに使用されるパスの内側にのみ描画が制限されます。私は反対をしたいと思う - だけを外に描画します。NSBezierPathを使用するaddClip - クリップを逆にする方法

- (void)drawRect:(NSRect)dirtyRect { 
    NSBezierPath *dontDrawInThis = ...; 

    //We want an opposite mask of [dontDrawInThis setClip]; 

    //Drawing comes here 
} 

答えて

0

これが私の解決策だった:iOS用

- (void)drawRect:(NSRect)dirtyRect { 
    NSBezierPath *dontDrawInThis = ...; 

    // The mask is the whole bounds rect, subtracted dontDrawInThis 

    NSBezierPath *clip = [NSBezierPath bezierPathWithRect:self.bounds]; 
    [clip appendBezierPath:dontDrawInThis.bezierPathByReversingPath]; 
    [clip setClip]; 

    //Drawing comes here 
} 

はCGRectとNSRectを交換してください。

+0

'bezierPathByReversingPath'は、XaraminのiOSセクションにあります。 – Todd

関連する問題