Rects and points...
Rects and points...
- Subject: Rects and points...
- From: Riccardo Santato <email@hidden>
- Date: Tue, 20 Nov 2001 16:16:31 +0100
Hi there.
I'd reaally like someone of you help me in making this code work.
I'm just having fun with Bezier curves, but nothing is displayed... Can
you tell me please where are the errors ?
Many thanx to everyone 4 your kindness
- (IBAction)draw:(id)sender
{
// Point definitions
point_a = NSMakePoint(0.0, 0.0);
point_b = NSMakePoint(100.0, 100.0);
point_c = NSMakePoint(50.0,50.0);
NSLog (@"points: defined");
// Rectangle definition
view_rect = [self bounds];
// View allocation
[self initWithFrame:view_rect];
// Initializations
[self setNeedsDisplay:YES];
curve = [NSBezierPath bezierPathWithRect:view_rect];
[self convertPoint:point_a toView:self];
[self convertPoint:point_b toView:self];
[self convertPoint:point_c toView:self];
[[NSColor blackColor] set];
[curve moveToPoint:point_a];
[curve lineToPoint:point_b];
[curve lineToPoint:point_c];
[curve curveToPoint:point_a controlPoint1:point_b controlPoint2:point_c];
[self drawRect:view_rect];
[self displayRect:view_rect];
}
@end
--
Riccardo Santato
www.riccardosantato.com