D3D:如何从 x,y 坐标获取颜色

D3D: How can i get color from a x,y coordinate?

本文关键字:坐标 获取 颜色 D3D      更新时间:2023-10-16

如何通过 D3D 全屏程序从 x,y 坐标获取颜色类型?

我想确定 x,y 点是否为红色 255

提前谢谢。

由于您尚未指定DX版本,因此只有简短的分步算法

1) Render your scene to texture
2) Transfer tetxure back from GPU to CPU
3) Fill data from tetxure to memory buffer
5) Recalculate x, y to match tetxure resolution. Rendering window dimension can be different from DX device resolution (you can render smaller texture to bigger window and vice versa)
4) Do lookup at position [x,y]

如果您问如何从第三方DX程序获取像素颜色,则必须以某种方式获取应用程序的"屏幕截图"并在其中搜索颜色