 |
 |
bezierpath problems
|
 |
|
 |
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
- (void)drawRect  NSRect)frameRect
{
NSPoint point0;
NSPoint point1;
int i;
bezier = [NSBezierPath bezierPath];
minMaxArray = [...];
NSMutableArray *minMaxDate;
minMaxDate = [[NSMutableArray alloc] init];
[minMaxDate setArray:[...]];
point0.x = frameRect.origin.x;
point0.y = (frameRect.size.height * ([[[minMaxDate objectAtIndex: 0] objectForKey:@"KEY"] intValue]) / ([[[minMaxArray objectAtIndex  [minMaxArray count] -1)] objectForKey: @"KEY"] intValue] - [[[minMaxArray objectAtIndex:0] objectForKey: @"KEY"] intValue]));
for(i=1; i < ([minMaxDate count]); i++)
{
point1.x = point0.x + (frameRect.size.width / ([minMaxDate count]));
point1.y = (frameRect.size.height * ([[[minMaxDate objectAtIndex: i] objectForKey:@"KEY"] intValue]) / ([[[minMaxArray objectAtIndex  [minMaxArray count] -1)] objectForKey: @"KEY"] intValue] - [[[minMaxArray objectAtIndex:0] objectForKey: @"KEY"] intValue]));
[bezier moveToPoint  oint0];
[bezier lineToPoint  oint1];
[NSBezierPath strokeLineFromPoint  oint0 toPoint  oint1];
/* Also tried this
[bezier moveToPoint  oint0];
[bezier lineToPoint  oint1];
*/
point0.x = point1.x;
point0.y = point1.y;
}
}
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Feb 2000
Location: Washington, DC
Status:
Offline
|
|
Wow, I don't code much, but that's a hard sell... perhaps you should have used the code/text tag or something...
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
What exactly is the problem?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Yeah, between the smilies, the lack of whitespace formatting, and the not telling us what the problem is, that's a toughie. 
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
Originally posted by macrophyllum:
What exactly is the problem?
How about this "No lines appear on the view" for a problem?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Well, you do realize that you can't normally predict what the argument for drawRect: will be, right? It could be any arbitrary rectangle within your view. Using its properties for anything other than clipping is an iffy proposition.
With the utter lack of explanation as to what you intend for the code to do and what the variables represent, that's about all anyone could possibly say.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
It might help to add an '[[NSColor blackColor] set]' in there before you do the drawing.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
Originally posted by Chuckit:
Well, you do realize that you can't normally predict what the argument for drawRect: will be, right? It could be any arbitrary rectangle within your view. Using its properties for anything other than clipping is an iffy proposition.
With the utter lack of explanation as to what you intend for the code to do and what the variables represent, that's about all anyone could possibly say.
I'm trying to draw a line that connects points that are given by minMaxArray and minMaxDate [that take the values from a NSDictionary.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
Originally posted by smeger:
It might help to add an '[[NSColor blackColor] set]' in there before you do the drawing.
Nope, didn't do much good 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
After calling
[bezier moveToPoint:point0];
[bezier lineToPoint:point1];
try putting:
[bezier stroke];
Also, in case the points aren't comming from the dictionary so well, try making up some arbitrary points first.
For example:
point0 = NSMakePoint(10, 50);
point1 = NSMakePoint(30, 100);
Of course, define your points before you use call the moveTo, lineTo and stroke methods.
Goodluck.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
After calling
[bezier moveToPoint:point0];
[bezier lineToPoint:point1];
try putting:
[bezier stroke];
Also, in case the points aren't comming from the dictionary so well, try making up some arbitrary points first.
For example:
point0 = NSMakePoint(10, 50);
point1 = NSMakePoint(30, 100);
Of course, define your points before you use call the moveTo, lineTo and stroke methods.
Goodluck.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|