• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Help with NSBitmapImageRep, please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with NSBitmapImageRep, please


  • Subject: Help with NSBitmapImageRep, please
  • From: M Pulis <email@hidden>
  • Date: Thu, 30 Oct 2008 17:12:48 -0700

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help with NSBitmapImageRep, please
      • From: Ken Thomases <email@hidden>
    • Re: Help with NSBitmapImageRep, please
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Type comparison warning
  • Next by Date: Re: Type comparison warning
  • Previous by thread: Re: When and how often do you mix C++ with Objective C in your project?
  • Next by thread: Re: Help with NSBitmapImageRep, please
  • Index(es):
    • Date
    • Thread