开发者

Setting the pixel format of an existing Bitmap in GDI+

How do I 开发者_开发问答set the PixelFormat property in a GDI+ Bitmap if I can't use one of the constructors that allow me to specify it? It looks like the PixelFormat property itself is read-only.


I ended up using the following method of creating a second bitmap with the desired pixel format and drawing the original image on to it.

Bitmap *pTempBitmap = new Gdiplus::Bitmap(_Module.m_hInst, MAKEINTRESOURCE(lImageResource));
m_pGDIBitmap = new Bitmap(pTempBitmap->GetWidth(), pTempBitmap->GetHeight(), PixelFormat32bppARGB);
Graphics TempGraphics(pTempBitmap);
TempGraphics.DrawImage(m_pGDIBitmap, Point(0,0));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜