There are two functions or methods in BiDib DLL or OCX to convert an image to grayscale with antialiasing. The name of the functions are ConvertMonoDIBtoGrayscale and ConvColorDIBtoGrayscale. You can use these functions to convert the DIB to grayscale before displaying.
[C++]
#include “BiDib.h”
void CMyView::Convert(HDIB hDib)
{
HDIB hDibNew;
if (!hDib)
return;
// The DIB is monochrome or not
if (IsMono(hDib))
// 1. parameter: Handle of the DIB
// 2. parameter: Antialiasing method (antialiasing with 3x3 resampling area)
hDibNew = ConvertMonoDIBtoGrayscale(hDib, 1);
else
// 1. parameter: Handle of the DIB
// 2. parameter: Antialiasing method (antialiasing with 3x3 resampling area)
// 3. parameter: TRUE: the resulted (gray) pixel value is the weighted sum of 'red',
// 'green' and 'blue' components.
// FALSE: the resulted (gray) pixel value is the simple average of
// colour components.
hDibNew = ConvColorDIBtoGrayscale(hDib, 1, TRUE);
if (!hDibNew)
{
// Error
}
}
[C#]
private void Convert(long hDib)
{
long hDibNew = 0;
if (hDib == 0)
return;
if (BiDisp.ColorDepth == 1)
// 1. parameter: Handle of the DIB
// 2. parameter: Antialiasing method (antialiasing with 3x3 resampling area)
hDibNew = BiDib.ConvertMonoDIBToGrayscale(hDib, 1);
else
// 1. parameter: Handle of the DIB
// 2. parameter: Antialiasing method (antialiasing with 3x3 resampling area)
// 3. parameter: TRUE: the resulted (gray) pixel value is the weighted sum of 'red',
// 'green' and 'blue' components.
// FALSE: the resulted (gray) pixel value is the simple average of
// colour components.
hDibNew = BiDib.ConvColorDIBToGrayscale(hDib, 1, true);
if (hDibNew == 0)
{
// Error
}
}