【问题标题】:Setting the pixel format of an existing Bitmap in GDI+在 GDI+ 中设置现有位图的像素格式
【发布时间】:2010-05-05 14:44:12
【问题描述】:

如果我不能使用允许我指定的构造函数之一,如何在 GDI+ 位图中设置 PixelFormat 属性?看起来 PixelFormat 属性本身是只读的。

【问题讨论】:

    标签: c++ gdi+ gdi


    【解决方案1】:

    我最终使用以下方法创建具有所需像素格式的第二个位图并将原始图像绘制到上面。

    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));
    

    【讨论】:

      猜你喜欢
      • 2015-03-12
      • 2018-12-13
      • 2019-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-29
      • 1970-01-01
      相关资源
      最近更新 更多