how can a pixel in a bitmap can be deleted?
i m decreasing the resolution of a bitmap. i found a method on a site which is as follows
Average the values of all surrounding pixels, store that value in the choosen pixel location, then delete all the surrounding pixels.so a 4*6 matrix becomes a 4 x 3 matrix.
i am accessing pixels by this code
for(int y = 0; y < bmp.bmHeight; y++)
{
for(int x = 0; x < bmp.bmWidth; x++)
{
COLORREF rgb = dc.GetPixel(x, y);
BYTE r =开发者_如何学Go GetRValue(rgb);
BYTE g = GetGValue(rgb);
BYTE b = GetBValue(rgb);
dc.SetPixel(x, y, RGB(r,g,b));
}
}
tell me how can i delete a pixel?
You can't really delete a pixel, a bitmap is a matrix of pixels. Rather, you should make a new bitmap of the intended size, and copy pixels into that.
精彩评论