gpt4 book ai didi

direct2d - Direct2D 是否使用后台缓冲区?

转载 作者:行者123 更新时间:2023-12-04 06:14:12 25 4
gpt4 key购买 nike

阅读 https://learn.microsoft.com/en-us/windows/win32/direct2d/comparing-direct2d-and-gdi :

Presentation Model

When Windows wasfirst designed, there was insufficientmemory to allow every window to bestored in its own bitmap. As a result,GDI always rendered logically directlyto the screen, with various clippingregions applied to ensure that it didnot render outside of its window. Incontract, Direct2D follows a modelwhere the application renders to aback-buffer and the result isatomically “flipped” when theapplication is done drawing. Thisallows Direct2D to handle animationscenarios much more fluidly that GDIcan.

作者说 Direct2D 使用后台缓冲区,我猜他所说的“翻转”指的是交换链。我创建了一个简单的演示,可以在鼠标单击时在随机位置绘制一个矩形。但是之前的矩形没有被清除,所以看起来它是直接绘制到屏幕上的,不使用任何后台缓冲区。

最佳答案

当您为 Direct2D 操作初始化 RenderTarget 时,您可以在第二个参数中指定 D2D1_PRESENT_OPTIONS 选项。

我认为让您感到困惑的是 D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS 以及缓冲区不是交换而是复制的事实。

关于direct2d - Direct2D 是否使用后台缓冲区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6414756/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com