Drawing a Display Context
[The feature associated with this page, DrawDib, is a legacy feature. It has been superseded by MediaComposition class. MediaComposition class has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaComposition class instead of DrawDib, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The following example prepares a DrawDib DC by using the DrawDibRealize function prior to displaying several images in a bitmap sequence.
hdc = GetDC(hwnd);
DrawDibBegin(hdd, hdc, dxDest, dyDest, lpbi, dxSrc, dySrc, NULL);
DrawDibRealize(hdd, hdc, fBackground);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
ReleaseDC(hwnd, hdc);
Related topics