Re: [Pyobjc-dev] Anyone using Foundation.NSRectFillList?
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-07-23 16:47:56
|
On Wednesday, 23 July, 2003, at 18:22, b.bum wrote: > On Tuesday, July 22, 2003, at 12:16 PM, Ronald Oussoren wrote: >> I just noticed that the interface of the wrapped NSRectFillList is a >> bit odd. Is anyone using this function at the moment, I'd like to >> clean up the interface. >> >> The current interface accepts a string containing the struct.pack-ed >> representation of an array of NSRects, >> it should accept a sequence of NSRects instead. > > If you are talking about a sequence of python tuples/lists, it should > not though accepting both would certainly be preferable. The current implementation (checked in this morning, MEST) accepts the 'old' style arguments as well as a sequence of python tuples representing NSRects. > > That implementation came out of my quest to see how fast I could get > individual pixels to the screen. The answer is an array of 1x1 > rectangles passed to NSRectFillList(). Packing/unpacking across the > bridge is painfully slow -- an order of magnitude slower -- than using > an array of of struct packed floats. > > I have been meaning to turn the app I used to do the testing into an > example. Using NSBezierPath generated about 10,000 points every 2 > seconds... NSBitmapImageRep could plot around 25,000 or something.... > NSRectFillList as currently implemented could do 250,000 points every > 2 seconds. Speed is an issue of course, but I'd expect that using the new arguments would be as fast as struct.pack + old arguments. That is, unless you draw the same rects over and over again. I'll leave the old-style arguments in for when speed is really important. Ronald |