Re: Drawing strings at 20fps
Re: Drawing strings at 20fps
- Subject: Re: Drawing strings at 20fps
- From: "Louis C. Sacha" <email@hidden>
- Date: Mon, 26 Jul 2004 23:24:29 -0700
Hello...
This doesn't have anything to do with drawing the strings, but if
drawing the grid is taking a significant amount of time, you can
probably also speed that up considerably by using the
NSRectFillList() function to fill a cached list of 128 NSRects
instead of stroking an NSBezierPath containing 128 lines.
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Functions/AppKitFunctions.html#//apple_ref/c/func/NSRectFillList
Hope that helps,
Louis
Hi list,
I have a 64 X 64 grid of 3 character strings to display at 20 fps. These
strings can (as a worst case) all change from 0 to 127 at the same rate.
The background is white and there is also a grid that9s separates the
strings to be displayed.
I have overridden the isOpaque to return YES. In my drawRect:(NSRect)rect
method, I only draw the background on rect. I have a NSBezierPath defined
with 64 horizontal lines and 64 vertical lines.
...
Cheers,
Jules Bonin-Ducharme
Here is my drawRect method.
--------------------------------
- (void)drawRect:(NSRect)rect
{
[[NSColor whiteColor] set];
NSFillRect(rect);
paint the grid
[[NSColor blackColor] set];
[grid stroke];
// draw each input row strings
int i;
for (i = 0; i < 64; i++) {
[[inputRows objectAtIndex:i]
drawAtPoint:NSMakePoint(4, ((64 - 1 - i) * 15) + 1)
withAttributes:attributes];
}
}
--------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.