title: Non-deprecated replacement for NSCalibratedBlackColorSpace?
body: <p>I'm implementing my own <code>NSBitmapImageRep</code> (to draw PBM image files). To draw them, I'm using <code>NSDrawBitmap()</code> and passing it the <code>NSCalibratedBlackColorSpace</code> (as the bits are 1 for black, 0 for white).</p>
  
  <p>Trouble is, I get the following warning:</p>
  
  <pre><code>warning: 'NSCalibratedBlackColorSpace' is deprecated
  </code></pre>
  
  <p>However, I couldn't find a good replacement for it. <code>NSCalibratedWhiteColorSpace</code> gives me an inverted image, and there seems to be no way to get <code>NSDrawBitmap()</code> to use a <code>CGColorSpaceRef</code> or <code>NSColorSpace</code> that I could create as a custom equivalent to <code>NSCalibratedBlackColorSpace</code>.</p>
  
  <p>I've found a (hacky) way to shut up the warning (so I can still build warning-free until a replacement becomes available) by just passing <code>@"NSCalibratedBlackColorSpace"</code> instead of the symbolic constant, but I'd rather apply a correct fix.</p>
  
  <p>Anybody have an idea?</p>
  
  <hr>
  
  <p>OK, so I tried</p>
  
  <pre><code>NSData*     pixelData = [[NSData alloc] initWithBytes: bytes +imgOffset length: [theData length] -imgOffset];
  CGFloat     black[3] = { 0, 0, 0 };
  CGFloat     white[3] = { 100, 100, 100 };
  CGColorSpaceRef calibratedBlackCS = CGColorSpaceCreateCalibratedGray( white, black, 1.8 );
  CGDataProviderRef provider = CGDataProviderCreateWithCFData( UKNSToCFData(pixelData) );
  mImage = CGImageCreate( size.width, size.height, 1, 1, rowBytes, calibratedBlackCS, kCGImageAlphaNone,
                          provider, NULL, false, kCGRenderingIntentDefault );
  CGColorSpaceRelease( calibratedBlackCS );
  </code></pre>
  
  <p>but it's still inverted. I also tried swapping black/white above, didn't change a thing. Am I misinterpreting the CIE tristimulus color value thing? Most docs seem to assume you know what it is or are willing to transform a piece of matrix maths to figure out what color is what. Or something.</p>
  
  <p>I'd kinda like to avoid having to touch all the data once and invert it, but right now it seems like the best choice (/me unpacks his loops and xor operators).</p>