三角形のカットアウトを元に戻すのに助けが必要です。
右側に三角形の切り欠きがある長方形を作成できます。
これらの座標を使用して:
NSInteger imageWidth=12, imageHeight=22;
NSImage* destImage = [[NSImage alloc] initWithSize:NSMakeSize(imageWidth,imageHeight)];
[destImage lockFocus];
// Constructing the path
NSBezierPath *leftTriangle = [NSBezierPath bezierPath];
[leftTriangle setLineWidth:1.0];
[leftTriangle moveToPoint:NSMakePoint(imageWidth+1, 0.0)];
[leftTriangle lineToPoint:NSMakePoint( 0, imageHeight/2.0)];
[leftTriangle lineToPoint:NSMakePoint( imageWidth+1, imageHeight)];
[leftTriangle closePath];
[[NSColor controlColor] setFill];
[[NSColor clearColor] setStroke];
...
次のように、反対側にカットアウトを作成するために使用する座標は次のとおりです。
更新: 洗練されていない解決:
測定は左下から始まることを覚えておくと役に立ちました。
NSBezierPath *rightTriangle = [NSBezierPath bezierPath]; [rightTriangle setLineWidth:1.0]; [rightTriangle moveToPoint:NSMakePoint(0.0, 29)]; [rightTriangle lineToPoint:NSMakePoint( imageWidth, 20)]; [rightTriangle lineToPoint:NSMakePoint(0.0, 11)];