Skip navigation.
 
mlA Question about Bezier Paths..
FROM : Brian O'Brien
DATE : Fri Apr 01 23:14:36 2005

I've written this code to draw an oval and I want to draw 4 small
squares at the corners of the bounding box of the oval.
However the boxes all appear at the origin.  (Perhaps I need to do
some translations?)

- (void) drawRect:(NSRect) rects
{
    [super drawRect:rects];

    NSRect aRect          = NSMakeRect(0.0, 0.0, 50.0, 50.0);
    NSRect aSmallCtrlPoint = NSMakeRect(0.0, 0.0, 10.0, 10.0);

    NSAffineTransform *transform = [NSAffineTransform transform];
    NSBezierPath *mainPath = [NSBezierPath bezierPath];

    [[NSColor greenColor] set];

    [mainPath appendBezierPathWithOvalInRect:aRect];

    [mainPath moveToPoint:bl];
    [mainPath appendBezierPathWithRect:aSmallCtrlPoint];
    [mainPath moveToPoint:br];
    [mainPath appendBezierPathWithRect:aSmallCtrlPoint];
    [mainPath moveToPoint:tl];
    [mainPath appendBezierPathWithRect:aSmallCtrlPoint];
    [mainPath moveToPoint:tr];
    [mainPath appendBezierPathWithRect:aSmallCtrlPoint];

    [mainPath stroke];
}

Related mailsAuthorDate
mlA Question about Bezier Paths.. Brian O'Brien Apr 1, 23:14
mlRe: A Question about Bezier Paths.. Shawn Erickson Apr 1, 23:47