Direct3D 9 中表面的部分变暗
在 Direct3D 9 中,我尝试这样修改表面:
给定一个矩形,对于矩形边界内给定表面中的每个像素,每个通道(R、G、B、A)将乘以某个(浮动)值来使其变暗或变亮。
我该怎么做呢?最好我想避免使用 LockRect (特别是因为它似乎不适用于默认池)。
In Direct3D 9, I'm trying to modify a surface thus:
Given a rectangle, for each of the pixels in the given surface within the rectangle's bounds, each of the channels (R, G, B, A) would be multiplied by a certain (float) value to either dim or brighten it.
How would I go about doing this? Preferably I want to avoid using LockRect (especially as it seems to not work with the default pool).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想直接更新 Surfaces 像素,可以使用“Device.UpdateTexture”。这会将 Pool.SystemMemory 中创建的纹理更新为 Pool.Default 中创建的纹理。
但这听起来不像您想做的事情。使用效果来硬件加速。如果您想知道我如何向您展示。
If you are wanting to update a Surfaces pixels directly, you can use "Device.UpdateTexture". This updates a Texture created in Pool.SystemMemory to a Texture created in Pool.Default.
But this doesn't sound like what you want to be doing. Use an Effect to hardware accelerate this. If you would like to know how I can show you.