color management and GDI+
-
Hello, I wonder if anyone out there has some experience in using color management with GDI+? Specifically, when retrieving pixels from a GDI+ Bitmap using the LockBits/UnlockBits methods with a BitmapData object, should I assume that the RGB values in the BitmapData scan0 buffer are in linear light RGB space or gamma corrected RGB space? If gamma corrected, what white point/specific RGB space is used? Does it depend on how the Bitmap was constructed? Here are specific situations I need to know about: - If a GDI+ Bitmap is constructed using one of the methods that indicates embedded color management will be used, such as Bitmap::Bitmap(const WCHAR *filename,BOOL useIcm), how does that Bitmap apply color correction when useIcm is set to TRUE? Does it hand me gamma corrected RGB values in the BitmapData scan0 buffer, or linear light RGB values? What does it hand me if useIcm is set to FALSE? - If I later pass new data to the Bitmap above (constructed with useIcm = TRUE), using my own buffer and the ImageLockModeUserInputBuf flag, do I have to do my own gamma correction? That is, will the Bitmap object assume my data is linear RGB or gamma corrected RGB? - If I then draw the Bitmap to the screen or to a printer with a Graphics object constructed using Graphics::Graphics(HWND hwnd, BOOL icm), with icm set to TRUE, does the Graphics object expect the data in the Bitmap object to be gamma corrected or linear RGB? With what white point? Does it depend on how the Bitmap was constructed? What if the Graphics object was created with icm set to FALSE? What if either the Bitmap or the Graphics object uses ICM, and the other doesn't? - If I now use one of the Graphics::DrawImage methods with an ImageAttributes object, is the RGB data in the Bitmap object assumed to be in linear RGB? How do all these things interact? Excuse me if there is already documentation on this somewhere, but I have been unable to find it. I would very much like to know if there is some comprehensive documentation somewhere about how GDI+ uses ICM. Any information would be appreciated, but especially on the topic of what to do when passing my own pixel buffer to a Bitmap object using a BitmapData object with the ImageLockModeUserInputBuf flag set. Do I have to do all the color management on the data myself in that case? Or would that cause problems because the Bitmap expects to do that itself? Thanks for any help you can give. :cool: :)