PDA

View Full Version : GWorlds or direct bitmap access in Cocoa



dantheox
December 20th, 2001, 03:12 PM
I had a classic program that I wrote in Codewarrior which drew a fractal directly into a GWorld. I was able to obtain a pointer to the actual bitmap data, and just set individual bytes to draw my picture. This direct access method was extremely fast, and it worked great. Except that I can't figure out how to do it with Cocoa. The NSCachedImage class looked promising, but I can't figure out how to get a data pointer from it. NSBitmapImage has the data pointer, but I can't figure out how to create a blank one of any size. In CodeWarrior I just looked at the GWorld struct and found the "baseAddr" property, which was all I needed. This isn't possible in Cocoa.

Has anyone here had any helpful experience with offscreen drawing, particularly drawing which entails direct manipulation of the bitmap data?

Thanks -- Dan Vanderkam