I need some help reversing a triangle cutout.
I can make the rectangle with a triangle cutout on it's right:
using these coordinates:
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];
...
What coordinates would I use to make the cutout on the other side, like this:
UPDATE: Inelegantly solved:
It helped to remember that measurements begin at the bottom left.
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)];