Group,

I have a sensor device that give me raw data for an image of 1201 by 861 pixels at 16 bits per pixel.

Although monochromatic, I would like to represent it in an RGB bitmap. I use an NSInteger [3] to populate the pixels via setPixel.

The result I get looks like the old TV "horizontal hold" is screwy, so I know that either my bitmap specifications are bogus or the sensor data is packed different than expected. I can draw lines programmatically into the bitmap, so I _think_ I'm close.


The fragment creating the bitmap prior to the setPixel loops is:

                        NSBitmapImageRep *aFrameBitmap=nil;
                        aFrameBitmap = [NSBitmapImageRep alloc];
                        [aFrameBitmap initWithBitmapDataPlanes:nil
                                pixelsWide:colCount
                                pixelsHigh:rowCount
                                bitsPerSample:16
                                samplesPerPixel:3
                                hasAlpha:NO     
                                isPlanar:NO
                                colorSpaceName:@"NSCalibratedRGBColorSpace"
// bitmapformat:0 /*??? as seen in CocoaDrawingGuide/Images/ chapter_7_section_5 but Xcode error ???*/ bytesPerRow:(colCount*2)*3 // colCount pixels wide by 2 bytes per pixel by 3 colors (RGB)
                                bitsPerPixel:0]; // allow cocoa to calc value
                        
                        [NSGraphicsContext saveGraphicsState];
                        [NSGraphicsContext setCurrentContext:[NSGraphicsContext
                                
graphicsContextWithBitmapImageRep:aFrameBitmap]];
        

In support of the bogus specs theorem, however, are errors in the console that appear:

<Error>: CGBitmapContextCreate: unsupported parameter combination: 16 integer bits/component; 48 bits/pixel; 3-component colorspace; kCGImageAlphaNone; 7206 bytes/row.
<Error>: CGContextScaleCTM: invalid context

So, what is wrong am I missing here?

Thanks,

Gary
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to