- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我从来没有做过任何 GDI 编程,尽管在黑暗中拍了几张照片并搜索了文档,但我还没有找到将一个 DC 的内容复制到另一个 DC 的正确方法。
我现在的代码如下。我不明白为什么它不起作用(创建后窗口仍然空白)。
SIZE srcSize;
// ... Get size of source DC
HDC destDC = ...; // from GetDC(myWindow), myWindow was
// sized before this to properly contain source
HDC sourceDC = ...;
HBITMAP buffer = CreateCompatibleBitmap(sourceDC, srcSize.cx, srcSize.cy);
HGDIOBJ oldObj = SelectObject(destDC, buffer);
BitBlt(destDC, 0, 0, srcSize.cx, srcSize.cy, sourceDC, 0, 0, SRCCOPY);
SelectObject(destDC, oldObj);
DeleteObject(buffer);
//... ReleaseDC()s here
正确的做法是什么?
最佳答案
从一个 DC 复制到另一个 DC 所需的唯一东西是 BitBlt
。有效的代码如下。
SIZE srcSize;
// ... Get size of source DC
HDC destDC = ...; // from GetDC(myWindow), myWindow was
// sized before this to properly contain source
HDC sourceDC = ...;
BitBlt(destDC, 0, 0, srcSize.cx, srcSize.cy, sourceDC, 0, 0, SRCCOPY);
//... ReleaseDC()s here
关于c++ - 将一个 DeviceContext 的内容复制到另一个 DeviceContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10407500/
我从来没有做过任何 GDI 编程,尽管在黑暗中拍了几张照片并搜索了文档,但我还没有找到将一个 DC 的内容复制到另一个 DC 的正确方法。 我现在的代码如下。我不明白为什么它不起作用(创建后窗口仍然空
我有一个指向 COLORREF 缓冲区的指针,类似于:COLORREF* buf = new COLORREF[x*y]; 一个子程序用颜色信息填充这个缓冲区。每个 COLORREF 代表一个像素。
发生的事情是 ClearRenderTarget 在我的代码上不断崩溃,我想知道为什么。 这是我初始化 directX 及其所有代码的代码: #include "d3d.h" D3DClass::D3
我不明白为什么允许这样做: void Renderer::UpdateTextureFromArray(unsigned int* colors, unsigned int size, Texture
请帮助我处理 HDC 中的 alpha channel 。我让 HDC dc 抛出 CreateCompatibleDC。比调用 CreateDIBSection 可以在内存中找到图像字节。比调用 D
我在 Blender 中加载了一个 3D 场景。现在我想获取一些信息,例如场景中的对象、相机视角等。此外,我想获取 opengl 设备上下文和渲染上下文。类似于结构上的指针。 是否可以使用用 c/c+
我是一名优秀的程序员,十分优秀!