Re: NSBitmapImageRep problems
Re: NSBitmapImageRep problems
- Subject: Re: NSBitmapImageRep problems
- From: "John C. Randolph" <email@hidden>
- Date: Thu, 11 Oct 2001 13:47:42 -0700
On Thursday, October 11, 2001, at 01:35 PM, Per Ejeklint wrote:
Hi all,
this is my first post and I'm a rookie on Cocoa so please be gentle with
me! :)
I'm trying to get some raw RGB-data to display but have stuck on
NSBitmapImageRep. The data has 12 bits for each colour, stuffed in
arrays
made-up like this:
unsigned short *rgbPlanar[3];
rgbPlanar[0] = malloc(800*600*sizeof(unsigned short));
rgbPlanar[1] = malloc(800*600*sizeof(unsigned short));
rgbPlanar[2] = malloc(800*600*sizeof(unsigned short));
I then try to create an image representation like this.
tmpImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:
rgbPlanar
pixelsWide: 2176
pixelsHigh: 1448
bitsPerSample: 12
samplesPerPixel: 3
hasAlpha: NO
isPlanar: YES
colorSpaceName: NSDeviceRGBColorSpace
bytesPerRow: 0
bitsPerPixel: 16];
I can see one inconsistency here. If you have 12 bits per sample, then
you have 36 bits per pixel, not 16.
You might also want to just pass nil as the dataPlanes parameter, and
let NSBitmapImageRep set it up for you.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.