开发者

BitBlt from a color hDC to a monochrome hDC?

开发者 https://www.devze.com 2023-04-09 13:00 出处:网络
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 t

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

精彩评论

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