开发者

trying to copy a bitmap into the WMP Renderer -> upside down!

开发者 https://www.devze.com 2022-12-28 03:14 出处:网络
I\'m writing a video DMO decoder and trying to return a bitmap to the WMP renderer for display ... but WMP displays it upside down!

I'm writing a video DMO decoder and trying to return a bitmap to the WMP renderer for display ... but WMP displays it upside down!

This is the code :

HBITMAP*  hBmp = new HBITMAP();

int result;

m_pScrRenderer->CreateFrame(hBmp, &result);  ///This returns the HBITMAP handle.

BITMAP bmStruct;

memset(&bmStruct, 0, sizeof(BITMAP));

GetObject(*hBmp, sizeof(BITMAP), &bmStruct);  
int size = bmStruct.bmWidthBytes * bmStruct.bmHeight;
memcpy(pbOutData, bmStruct.bmBits, size); //PBoutData is WMP's renderer buffer.

This 开发者_运维知识库produces an upside down image. What should I change in this code?

Thank You!

Roey.


HBITMAP scanlines are read upside-down, you'll need to go through your data a scanline at a time and reverse it.

I'm not aware of an easy way to do this.


If you can change the parameters of the bitmap structure, you can give it a negative height to make the lines come out in top-down order.

0

精彩评论

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

关注公众号