• 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
Re: Color matching of NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color matching of NSBitmapImageRep


  • Subject: Re: Color matching of NSBitmapImageRep
  • From: Wim Lewis <email@hidden>
  • Date: Sat, 1 Sep 2007 13:23:13 -0700


On Aug 30, 2007, at 7:20 AM, Marcel Weiher wrote:
On Aug 29, 2007, at 5:54 PM, Wim Lewis wrote:
- Convert the color to the calibrated RGB space by calling [foo colorUsingColorSpaceName:NSCalibratedRGBColorSpace].
- Create an NSBitmapImageRep in the NSCalibratedRGBColorSpace, 32- bit RGBA:


NSBitmapImageRep *foo = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:buffer
pixelsWide:width pixelsHigh:height
bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace
bytesPerRow:4 * width bitsPerPixel:32];

[snip detailed description, all of which seemed correct]

Stepping through AppKit in the debugger, I find that NSBitmapImageRep is always using a color space created with CGColorSpaceCreateDeviceXXX (), regardless of whether the colorSpaceName I pass in is NSDeviceXXX or NSCalibratedXXX. (Unless I pass in NSDeviceRGBColorSpace, in which case it uses CGColorSpaceCreateDisplayRGB() --- still wrong...) If anyone at Apple cares to check this, it's in _NSCreateImageRef2() and _NSColorSpaceNumFromName(), as well as -[NSNSBitmapGraphicsContext _initWithBitmapImageRep:].


So I guess the not entirely unexpected answer to my question is "NSBitmapImageRep is just buggy". :(

Does your image actually have alpha transparency? If yes, are you accounting for the fact that NSBitmapImageRep stores its samples pre-multiplied? (Or have we stopped doing that?)

Alpha is always 1 in my test --- but even so, that wouldn't account for the decidedly nonlinear change in the color coordinates. :/





_______________________________________________

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


  • Prev by Date: [ANN] RegexKit - An Objective-C Framework for Regular Expressions Using the PCRE Library
  • Next by Date: Re: [ANN] RegexKit - An Objective-C Framework for Regular Expressions Using the PCRE Library
  • Previous by thread: Re: [ANN] RegexKit - An Objective-C Framework for Regular Expressions Using the PCRE Library
  • Next by thread: Cool window background color?
  • Index(es):
    • Date
    • Thread