1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| void PixelShader(HDC hDC, BYTE R, BYTE G, BYTE B, MODEFILTRAGE mode, RECT& zone)
{
int x;
int y;
BYTE Red;
BYTE Green;
BYTE Blue;
COLORREF cl;
for (y = zone.top ; y <= zone.bottom ; y++)
for (x = zone.left ; x <= zone.right ; x++)
{
if (mode == MF_RELATIF)
{
cl = GetPixel(hDC, x, y);
Red = 0x000000FF & cl;
Green = 0x0000FF00 & cl;
Blue = 0x00FF0000 & cl;
Red = (BYTE)((float)Red * (float)R / 100);
Green = (BYTE)((float)Green * (float)G / 100);
Blue = (BYTE)((float)Blue * (float)B / 100);
cl = RGB(Red, Green, Blue);
}
if (mode == MF_ABSOLUT)
cl = RGB(R, G, B);
SetPixel(hDC, x, y, cl);
}
} |
Partager