VOID Example_GetPixel(HDC hdc)
{
Graphics graphics(hdc); // Create a Bitmap object from a JPEG file.
Bitmap myBitmap(L"Climber.jpg"); // Get the value of a pixel from myBitmap.
Color pixelColor;
myBitmap.GetPixel(25, 25, &pixelColor); // Fill a rectangle with the pixel color.
SolidBrush brush(pixelColor);
graphics.FillRectangle(&brush, Rect(0, 0, 100, 100));
}
{
Graphics graphics(hdc); // Create a Bitmap object from a JPEG file.
Bitmap myBitmap(L"Climber.jpg"); // Get the value of a pixel from myBitmap.
Color pixelColor;
myBitmap.GetPixel(25, 25, &pixelColor); // Fill a rectangle with the pixel color.
SolidBrush brush(pixelColor);
graphics.FillRectangle(&brush, Rect(0, 0, 100, 100));
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货