用gdi32绘制像素 [英] Draw pixels with gdi32
本文介绍了用gdi32绘制像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用gdi32和c ++绘制和着色像素的帮助.有人可以帮忙吗?
I need help drawing and shading pixels with gdi32 and c++. Can anybody help?
推荐答案
这是一个想法
Here''s a thought
#define RGB_GETBLUE(rgb) (((rgb) >> 16) & 0xff)
#define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
#define RGB_GETRED(rgb) ((rgb) & 0xff)
COLORREF pix = ::GetPixel(hDC, x, y);
int red = RGB_GETRED(pix);
int green = RGB_GETGREEN(pix);
int blue = RGB_GETBLUE(pix);
float shadowEffect = 0.5f;
red = static_cast<int>(red * shadowEffect);
green = static_cast<int>(green * shadowEffect);
blue = static_cast<int>(blue * shadowEffect);
::SetPixel(hDC, x, y, RGB(red, green, blue));
这篇关于用gdi32绘制像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文