0

As we know, we can use WriteFrame to save bitmap to file in wic.

Here in the method WriteFrame,we can see a parameter ID2D1Bitmap object.When I use

m_d2dContext->CreateBitmapFromDxgiSurface(surface.Get(),&bitmapProperties,&myBitmap);

and then pass myBitmap to WriteFrame,I can't get the bitmap,it show me a black image. But when I use

m_d2dContext->CreateBitmapFromWicBitmap(pB.Get(), &m_Bitmap);

and pass m_Bitmap to WriteFrame, I can get the correct bitmap in the image file. Why this happen?

Can anyone help. Thank you.

Bos
  • 365
  • 2
  • 13
  • This might have to do with the fact that a bitmap created from a DXGI surface is an abstraction over a hardware surface. This is something that you *write to*; it's usually a bad idea to view this as a bitmap in the "query bits from here" sense (indeed, one has to jump through hoops to get bits from a IDXGISurface bitmap). What HRESULT does WriteFrame return? – susmits Nov 07 '13 at 07:14
  • @susmits WriteFrame returns S_OK.I also think that the surface bitmap is just used to drawing to, rather than drawing from.However,there is no documents say about this.It's a pity. – Bos Nov 07 '13 at 10:50

0 Answers0