I am working on some image processing functions. I have written a filtering function. It is working correctly when I process image which has 24bpp (EColor16M), yet it is not working for other display modes. I am using TBitmapUtil as it is much faster than CFbsBitGc. Documentation says that TBitmapUtil is working for all display modes.
I found out that TBitmapUtil is working using binary masks, when it sets pixel. For example EGray2 (only two possible colors - black and white) uses only 1 bit to represent color. In this way, TBitmapUtil::GetPixel() gets TRgb, which has wrong values in channels (Red is 0 or 1, Blue and Green always 0). CFbsBitmap would work correctly as CFbsBitmap::GetPixel will return TRgb which has proper values in channels (0 or 255). Similarly EColor16 uses 4 bits (Red 0 - 16, Blue and Green always 0), etc.
Does somebody know if it is a bug...?
The best way to omit this problem is to convert input image to EColor16M, process it and then convert back to previous TDisplayMode.