Pages

Sunday, October 11, 2009

Конвертировать графическое изображение средствами GDI+

Image * ConvertImage(Image * pSrcImage, Color &bgColor)
{
int width = pSrcImage->GetWidth();
int height = pSrcImage->GetHeight();
Bitmap * pDstBitmap;

if (!(pDstBitmap = new Bitmap(width, height, PixelFormat24bppRGB)))
{
return(0);
}

{
Rect rect(0, 0, width, height);
Graphics graphics(pDstBitmap);

graphics.FillRectangle(&SolidBrush(bgColor), rect);
graphics.DrawImage(pSrcImage, rect);
}

return(pDstBitmap);
}

No comments:

Post a Comment