NSImage-related error -21778

This is a real puzzler - I have read a 200 dpi 1-bit raster image from disk and plan to rotate it 90 degrees. I allocate the target NSBitmapImageRep and get pointer to the source and destination image data. After the rotation (seems to) complete, the destination image is blank (no pixels moved). In the Console, NSBitmapImageRep has output an error:

Failed to extract pixel data from NSBitmapImageRep. Error: -21778

No idea what this error code is or what it might be talking about. Anyone have a clue or know the definition of this error?

I ran into this - or something very much like it - and wrote about it at https://wadetregaskis.com/getbitmapdataplanes-can-break-nsimages-nsbitmapimagereps/. It seems to be a bug in NSBitmapImageRep that's triggered when you (or library code) calls bitmapData or getBitmapDataPlanes. You can maybe work around it by calling recache on the NSImage, if you don't actually need access to the bitmap's bytes.

NSImage-related error -21778
 
 
Q