FROM : Robert Murley
DATE : Fri Aug 04 18:52:58 2006
I have an NSBitmapImageRep with floating-point data samples. When I
attempt to display it, I get all white. Using the same code with 8-bit
integer samples works fine. The FP samples are all between zero and
one, and the alpha channel is all ones.
Could anyone enlighten me as to what I am doing wrong?
Code to create the image rep:
NSBitmapFormat format = NSAlphaFirstBitmapFormat |
NSFloatingPointSamplesBitmapFormat;
imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: data
pixelsWide: width
pixelsHigh: height
bitsPerSample: 32
samplesPerPixel: 4
hasAlpha: YES
isPlanar: YES
colorSpaceName: NSCalibratedRGBColorSpace
bitmapFormat: format
bytesPerRow: rowBytes
bitsPerPixel: 32];
Code to display it:
IBOutlet NSImageView *imageView;
NSImage *image;
- (void) displayView: (NSBitmapImageRep *) imageRep
{
image = [[NSImage alloc] init];
[image addRepresentation: imageRep];
[imageView setImage: image];
[imageView display];
}
DATE : Fri Aug 04 18:52:58 2006
I have an NSBitmapImageRep with floating-point data samples. When I
attempt to display it, I get all white. Using the same code with 8-bit
integer samples works fine. The FP samples are all between zero and
one, and the alpha channel is all ones.
Could anyone enlighten me as to what I am doing wrong?
Code to create the image rep:
NSBitmapFormat format = NSAlphaFirstBitmapFormat |
NSFloatingPointSamplesBitmapFormat;
imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: data
pixelsWide: width
pixelsHigh: height
bitsPerSample: 32
samplesPerPixel: 4
hasAlpha: YES
isPlanar: YES
colorSpaceName: NSCalibratedRGBColorSpace
bitmapFormat: format
bytesPerRow: rowBytes
bitsPerPixel: 32];
Code to display it:
IBOutlet NSImageView *imageView;
NSImage *image;
- (void) displayView: (NSBitmapImageRep *) imageRep
{
image = [[NSImage alloc] init];
[image addRepresentation: imageRep];
[imageView setImage: image];
[imageView display];
}
| Related mails | Author | Date |
|---|---|---|
| Robert Murley | Aug 4, 18:52 | |
| Michael Ash | Aug 5, 00:22 |






Cocoa mail archive

