[Openmcl-devel] Advice needed: best way to fram a Lisp array into an ns-image
Ron Garret
ron at awun.net
Fri Jan 18 17:15:50 PST 2008
What is the easiest way to fram a Lisp array of numbers representing
pixel data into an ns-image object? The best I've been able to come
up with is:
1. Create the NSImage and initialize it with initWithSize
2. Create an NSData object and stick the pixel data into it.
2. Create an NSBitMapImageRep and initialize it with (deep breath)...
initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel
(Whew!)
3. Add the NSBitMapImageRep to the NSImage using addRepresentation:
But that seems horribly clunky compared to how easy everything else
having to do with images is turning out to be. Is there a better way
to do this?
(BTW, the only reason I really need to do this is that getPixel:atX:y:
and setPixel:atX:y:: are gawdawful slow, like a thousand times slower
than an aref. If there's a fast way to access pixels directly from a
NSBitMapImageRep then I can just use that. But it seems like there's
not.)
Thanks,
rg
More information about the Openmcl-devel
mailing list