GDI+ draw image
void CGdiplusDemoView::OnDraw(CDC* pDC)
{
Graphics g(pDC->m_hDC);
// Read image file, *.bmp, *.gif, *.png, *.jpg format supported
Image image(L"test.jpg");
int width = image.GetWidth();
int height = image.GetHeight();
// Display image
g.DrawImage(&image, 10, 10, width, height);
// Display distorted image
Point points[] = {
Point(250, 20), Point(150, 100), Point(300, 50)
};
g.DrawImage(&image, points, 3);
// Magnified display
g.SetInterpolationMode(InterpolationModeNearestNeighbor);
g.DrawImage(&image, 10, 150, width*2, width*2);
g.SetInterpolationMode(InterpolationModeHighQualityBilinear);
g.DrawImage(&image, 220, 150, width*2, width*2);
}
댓글 없음:
댓글 쓰기