开发者

BitBlt from a color hDC to a monochrome hDC?

I am doing BitBlt from one 8 bit color DC to a monochrome DC. The problem is only pixel with values 255 are converte开发者_JS百科d to white in the monochrome DC. How do I specify threshold value, so that any pixel with value greater than 128 is displayed as white in the monochrome DC.


You can't.

According to the MDSN page of MFC CDC::BitBlt :

To convert color to monochrome, BitBlt sets pixels that match the background color to white and sets all other pixels to black. BitBlt uses the foreground and background colors of the color device context to convert from color to monochrome.

and CDC::BitBlt calls ::BitBlt:

_AFXWIN_INLINE BOOL CDC::BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop)
{
    ASSERT(m_hDC != NULL);
    return ::BitBlt(m_hDC, x, y, nWidth, nHeight, pSrcDC->GetSafeHdc(), xSrc, ySrc, dwRop);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜