0

这是一个奇怪的问题,我已经阅读了 BitBlt 函数的文档,它在大多数情况下都可以正常工作,但是如果我尝试从偏移量很大的源矩形复制数据,它就会开始失败(只复制一部分甚至没有复制)比目的地大...奇怪??以下是几个示例:

这是我使用的代码,结果取决于我传递的参数。位图的宽度m_iTileAreaWidth + 2 * m_iTileAreaMargin和高度分别为m_iTileAreaHeight + 2 * m_iTileAreaMargin

BOOL bBltOk = ::BitBlt(_hdcDest, 0, 0, m_iTileAreaWidth, m_iTileAreaHeight,
                       hdcSource, m_iTileAreaMargin, m_iTileAreaMargin, SRCCOPY);

如果m_iTileAreaMargin600并且都是200m_iTileAreaWidth复制 130px的源区域m_iTileAreaHeight

如果m_iTileAreaMargin500并且都是200m_iTileAreaWidth则复制完整的源m_iTileAreaHeight

如果m_iTileAreaMargin800并且都是200则不复制m_iTileAreaWidth任何源区域m_iTileAreaHeight

好吧,我确定整个区域都已生成 - 当我使用此代码时:

bBltOk = ::BitBlt(_hdcDest, 0, 0, rcScreen.Widht(), rcScreen.Height(),
                  _hdcSource, 0, 0,SRCCOPY);

然后我看到整个区域生成

有谁知道为什么我对这么简单的功能有这样的问题?

4

1 回答 1

0

problem solved - yet some mistery remains. Problem was that source bitmap (or hdc, don't have access to some of internals) was not configured to hold all required data (size too small).

Mistery is that I was able to copy whole area and get valid data, but when tried to copy only some parts (even one that was already in whole area) I got empty data.

于 2012-07-17T15:22:37.440 回答