帮忙看看这个位图操作函数是做什么的?很简单的。
void CCISBitmap::DrawTransparent(CDC * pDC, int x, int y, COLORREF crColour,
int zoom)
{
COLORREF crOldBack = pDC->SetBkColor(m_crWhite);
COLORREF crOldText = pDC->SetTextColor(m_crBlack);
CDC dcImage, dcTrans;
// Create two memory dcs for the image and the mask
dcImage.CreateCompatibleDC(pDC);
dcTrans.CreateCompatibleDC(pDC);
// Select the image into the appropriate dc
CBitmap* pOldBitmapImage = dcImage.SelectObject(this);
// Create the mask bitmap
CBitmap bitmapTrans;
int nWidth = Width();
int nHeight = Height();
bitmapTrans.CreateBitmap(nWidth, nHeight, 1, 1, NULL);
// Select the mask bitmap into the appropriate dc
CBitmap* pOldBitmapTrans = dcTrans.SelectObject(&bitmapTrans);
CBitmap* pOldBitmapTrans = dcTrans.SelectObject(&bitmapTrans);
// Build mask based on transparent colour
dcImage.SetBkColor(crColour);
dcTrans.BitBlt(0, 0, nWidth, nHeight, &dcImage, 0, 0, SRCCOPY);
// Do the work - True Mask method - cool if not actual display
主要是下面的几条语句不知道是干什么的。
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcImage, 0, 0,
nWidth, nHeight, SRCINVERT);
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcTrans, 0, 0 ,
nWidth, nHeight, SRCAND);
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcImage, 0, 0,
nWidth, nHeight, SRCINVERT);
// Restore settings
dcImage.SelectObject(pOldBitmapImage);
dcTrans.BitBlt(0, 0, nWidth, nHeight, &dcImage, 0, 0, SRCCOPY);
// Do the work - True Mask method - cool if not actual display
主要是下面的几条语句不知道是干什么的。
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcImage, 0, 0,
nWidth, nHeight, SRCINVERT);
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcTrans, 0, 0 ,
nWidth, nHeight, SRCAND);
pDC->StretchBlt(x, y, nWidth/zoom, nHeight/zoom, &dcImage, 0, 0,
nWidth, nHeight, SRCINVERT);
// Restore settings
dcImage.SelectObject(pOldBitmapImage);
dcTrans.SelectObject(pOldBitmapTrans);
pDC->SetBkColor(crOldBack);
pDC->SetTextColor(crOldText);
}