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];
}
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 mails | Author | Date |
|---|---|---|
| Brian O'Brien | Apr 1, 23:14 | |
| Shawn Erickson | Apr 1, 23:47 |






Cocoa mail archive

