DirectX9中处理图片像素问题?

来源:百度知道 编辑:UC知道 时间:2024/05/15 08:40:07
先对能看到这个问题的人表示感谢.
我现在遇到了一个用DirectX9开发游戏的问题,我是一个新手,对这个问题看过书搜过网站,但一直没有找到,如果有高手能在这里帮助我,那我将感激不尽.问题是这样的:
程序读取一张图读,并绘制在屏幕上,图片有部分是白色,假设我设置按下键盘上某一键使这个图片白色部分改变其颜色成为黑色,请问我该如何取得这个图片白色部分的像素,用什么方法去改变这白色部分像素点的颜色?
我现在只找到了这个问题的原理,具体如何取得图片的像素和改变像素的方法没有,所以希望有高人能帮帮我.
献上小分50分(我只有这么多),在此谢过.
不用GDI呀!

建立一个黑色的位图,直接用特别rop 去blt一下。
或者直接用黑色的刷子刷。

Windows GDI
SetROP2
The SetROP2 function sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined.

int SetROP2(
HDC hdc, // handle to DC
int fnDrawMode // drawing mode
);
Parameters
hdc
[in] Handle to the device context.
fnDrawMode
[in] Specifies the mix mode. This parameter can be one of the following values. Mix mode Description
R2_BLACK Pixel is always 0.
R2_COPYPEN Pixel is the pen color.
R2_MASKNOTPEN Pixel is a combination of the colors common to both the screen and the inverse of the pen.
R2_MASKPEN Pixel is a combination of the colors common to both the pen and the screen.
R2_MASKPENNOT Pixel i