如何使用Direct2D API滚动窗口内容? [英] How to scroll window contents using Direct2D api?

查看:115
本文介绍了如何使用Direct2D API滚动窗口内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过ID2D1RenderTarget滚动其中使用Direct2D api进行绘制的窗口内容。



在GDI中,我可以使用CreateCompatibleDC创建一个缓冲区,然后滚动其内容使用ScrollDC,将裸露的区域重新绘制,并将BitBlt的缓冲区重新绘制到窗口。如何在不使用GetDC(和GDI)且不使用自己的第三个缓冲区的情况下实现相同的功能?

解决方案



MSDN:平移二维对象就是沿x轴,y轴或同时沿这两个轴移动该对象。

  m_pRenderTarget-> SetTransform(D2D1 :: Matrix3x2F :: Translation(20,10)); 

此处有更多详细信息
http://msdn.microsoft.com/en-us/library/windows/desktop/dd756691( v = vs.85).aspx


I would like to scroll window contents in which drawing is performed with Direct2D api through ID2D1RenderTarget.

In GDI I could create a buffer with CreateCompatibleDC and later scroll its contents with ScrollDC, redraw exposed area and BitBlt the buffer to window.

I cannot see any necessary API in Direct2D to perform the same operations. How can I achieve the same functionality without using GetDC (and GDI), and without using own third buffer?

解决方案

You can use translation.

MSDN: To translate a 2-D object is to move the object along the x-axis, the y-axis, or both.

m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(20, 10));

More details here http://msdn.microsoft.com/en-us/library/windows/desktop/dd756691(v=vs.85).aspx

这篇关于如何使用Direct2D API滚动窗口内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆