Re: Rects and points...
Re: Rects and points...
- Subject: Re: Rects and points...
- From: André Benassi <email@hidden>
- Date: Tue, 20 Nov 2001 22:32:03 -0600
I would check out Mike Beams 2 very recent articles on
O'Reilly. Here are the links:
http://www.oreillynet.com/pub/a/mac/2001/10/19/cocoa.html
http://www.oreillynet.com/pub/a/mac/2001/11/06/cocoa.html
They seem to cover precisely what you are trying to study, and should
give you
a good start on how to properly use the NSBezierPath class.
On Tuesday, November 20, 2001, at 09:16 AM, Riccardo Santato wrote:
>
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
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev