Reputation: 41
i am writing a program that opens, rotates, scales,invert color,converts to grayscale and save bitmap (.bmp) But i dont seem to get the the converting to greyscale(ie black and white) working every other code works perfectly...
the code for my color inversion is below...
case 3:
{
hdc=GetDC(hWnd);
GetClientRect(hWnd,&rt);
BitBlt(hdc,0,0,rt.right,rt.bottom,hdc,0,0,NOTSRCCOPY);
ReleaseDC(NULL,hdc);
}
this seem to work but getting the DC and trying to change it to grey scale isn't working using BitBlt... I would like to get an idea on how to get the DC and convert it to grey-scale... winapi thanks...
Upvotes: 3
Views: 4058
Reputation: 47962
Raymond Chen gives a complete example of using the color mapper in GDI to convert a color image to grayscale using BitBlt.
Upvotes: 2