NSBitmapImageRep Colorspace Question
NSBitmapImageRep Colorspace Question
- Subject: NSBitmapImageRep Colorspace Question
- From: HAEUPL Friedrich - RTAA <email@hidden>
- Date: Wed, 14 Nov 2001 11:35:08 +0100
I'm writing a small program that displays greylevel pictures (Fileformat is .SPE).
A typical SPE-file contains a 4100 byte long header containing information about
size (width=1340, heigth=1300) and datacoding. Usually data is coded either as
float (4bytes intelformat) or as long(4bytes intelformat), where only 2 bytes are used.
After scaling down the long value to a byte, I write this byte to every color component
because I programmed
myNSBitmapImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:imageSize.width
pixelsHigh:imageSize.height
bitsPerSample:8 // 8 bit per color component
samplesPerPixel:3 // rgb components
hasAlpha:NO // no alpha channel
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace //
bytesPerRow:0 // 0 = no empty space at the end
bitsPerPixel:24];
I also tried to use myNSBitmapImageRep with colorSpaceName:NSCalibratedWhiteColorSpace
but this didn't work.
How do I have to configure NSBitmapImageRep to reduce the data written at every redraw? This would
reduce the written bytes from 5226000 to 1742000!
See sources at
http://www.geocities.com/macosx_sources/bitmap/how2display.html
Thanx for your help,
Fritz