Skip navigation.
 
mlTrouble drawing a polygon...
FROM : Brian O'Brien
DATE : Tue Apr 26 22:29:05 2005

My first polygon! :)
But nothing is drawing....


NSPoint p;
int i;

NSBezier * path = [NSBezierPath alloc] init];
[path setLineWidth:1.0];

// draw first set of points. green
for (i=0; i < npoints; ++i)
{
   p = [self getAPoint:i];
   [path lineToPoint:p];
}
[path closePath];
[[NSColor greenColor] set];
[path stroke];

// draw second set of points. red
for (i=0; i < npoints; ++i)
{
   p = [self getBPoint:i];
   [path lineToPoint:p];
}
[path closePath];
[[NSColor redColor] set];
[path stroke];

[path dealloc];


nothing displays... this is done in my drawrect function...
Have I misunderstood something?

What is the difference between this and say appendBezierPathWithPoints?
How do you add one point at a time with the append method?
It seems to want a pointer to a point array...

Related mailsAuthorDate
mlTrouble drawing a polygon... Brian O'Brien Apr 26, 22:29
mlRe: Trouble drawing a polygon... Shawn Erickson Apr 26, 22:54
mlRe: Trouble drawing a polygon... Brian O'Brien Apr 26, 22:55
mlRe: Trouble drawing a polygon... Brian O'Brien Apr 27, 00:02