找回密码
 立即注册
收起左侧

qt怎么用dib类型的指针显示图片

3
回复
7427
查看
[复制链接]
累计签到:5 天
连续签到:1 天
来源: 2018-6-14 15:46:05 显示全部楼层 |阅读模式
1Qter豆
本帖最后由 vipmachao 于 2018-6-14 15:48 编辑

MFC是void Listener1::frameReady(Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
{     
        
        CRect rect;
        viewWnd->GetWindowRect(&rect);
        CDC *dc=viewWnd->GetDC();
        smart_ptr<BITMAPINFOHEADER> pInf = pBuffer->getBitmapInfoHeader();
        SetStretchBltMode(dc->m_hDC , COLORONCOLOR);
             int nLines = StretchDIBits(
                dc->GetSafeHdc(),            // handle to the device context of the window
                 0,
                0,
                 rect.Width(),
                rect.Height(),
                 0,                        // x-coordinate of lower-left corner of the source rect
                 0,                        // y-coordinate of lower-left corner of the source rect
                 abs(pInf->biWidth),
                 abs(pInf->biHeight),
                 pBuffer->getPtr(),    // modified address of array with DIB bits
                 reinterpret_cast<LPBITMAPINFO>( &*pInf ),    // address of structure with bitmap info
                 DIB_RGB_COLORS,                // RGB or palette indices
                 SRCCOPY
                 );

         ReleaseDC(viewWnd->m_hWnd,dc->GetSafeHdc());
}
现在想用qt根据
     pBuffer->getPtr(),    // modified address of array with DIB bits
     reinterpret_cast<LPBITMAPINFO>( &*pInf ),    // address of structure with bitmap info
这两个参数展示图片 有做过的吗


回复

使用道具 举报

尚未签到

2018-6-16 14:14:02 显示全部楼层
qt和mfc混用?????  我记得以前有人说过不行,会冲突。
回复

使用道具 举报

累计签到:5 天
连续签到:1 天
2018-6-20 11:34:05 显示全部楼层
现在我已经解决了 换成另一种方式了
回复

使用道具 举报

累计签到:5 天
连续签到:1 天
2018-7-10 17:29:28 显示全部楼层
解决了 换了另一种方式
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了