CImage縮小圖片時顏色失真

先把目標DC (也就是 HDC hDestDC) ::SetStretchBltMode(hDestDC, HALFTONE);
同時再調用一下  ::SetBrushOrgEx(hDestDC, 0, 0, NULL);

然後再調用CImage的StretchBlt


例如


SetStretchBltMode(pDC->m_hDC, STRETCH_HALFTONE);

    img.StretchBlt(pDC->GetSafeHdc(), CRect(0, 0, nWidth, nHeight), CRect((int)(rectZoomBorder.left*iWidthRate), \
        (int)(rectZoomBorder.top * iHeightRate), (int)(rectZoomBorder.right*iWidthRate), \
        (int)(rectZoomBorder.bottom * iHeightRate)));

    img.ReleaseDC();
    img.Destroy();


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章