• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
using appendBezierPathWithPoints
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using appendBezierPathWithPoints


  • Subject: using appendBezierPathWithPoints
  • From: "William Zumwalt" <email@hidden>
  • Date: Wed, 11 Jul 2007 21:50:53 -0500

I'd like to know if I'm using the appendBezierPathWithPoints: correctly.
I've got a method where I create points and I can see that my axes in my
view are being drawn, but my points aren't. I'm trying to graph a function
while it's running. addPoint: is being called and passing in the correct
values as I expect.


@interface GraphView : NSView

{

int pointCount;

// wish i knew how to not hard-code this value of 1000

NSPointArray *points[1000];

}

...

- (void) addPoint:(double) val1 error:(double) val2

{

NSPoint point = NSMakePoint(val1, val2);

points[pointCount] = &point;

pointCount++;


[self setNeedsDisplay:YES];

return;

}


And then my drawRect: of my custom view try's to draw what I just added, but the setNeedsDisplay: doesn't call this method each time I add a point to my array above.


- (void) drawRect:(NSRect) rect

{

NSRect bounds = [self bounds];

[[NSColor blackColor] set];

[NSBezierPath fillRect:bounds];

NSBezierPath *errorPath = [NSBezierPath bezierPath];

[self drawAxes:rect path:errorPath];

[errorPath moveToPoint:NSMakePoint(40.0, 30.0)];


[self drawError:rect path:errorPath];

[[NSColor whiteColor] set];

[errorPath stroke];


return;

}


- (void) drawError:(NSRect) rect path:(NSBezierPath *) path

{

int i = 0;

for (i = 0; i < pointCount; i++) {

[path appendBezierPathWithPoints:points count:pointCount];

}

return;

}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: using appendBezierPathWithPoints
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: NSTableView is not updated.
  • Next by Date: linking dylib w/ test case dropping a thread
  • Previous by thread: Re: Re: NSTableView is not updated.
  • Next by thread: Re: using appendBezierPathWithPoints
  • Index(es):
    • Date
    • Thread