📄 subject_38283.htm
字号:
<p>
序号:38283 发表者:flowingsky 发表日期:2003-05-02 10:41:26
<br>主题:请问有了位图信息头和位图数据后,如何用directdraw把位图显示出来,谢谢!
<br>内容:在创建surface时,最大的问题是不知道像素格式如何确定。我是一个初学者恳请赐教。 <BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:super 回复日期:2003-05-04 14:07:19
<br>内容:缺省是屏幕颜色数,如果需要,可以指定DDSD_PIXELFORMAT并填充相关参数<BR><BR>至于显示,其实很简单的,先看看dxsdk中的samples
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Jony 回复日期:2003-05-14 18:08:55
<br>内容:bitmap信息头使用如下:祥见MSDN (BITMAPINFOHEADER)<BR>BITMAPINFOHEADER bih;<BR> memset( &bih, 0, sizeof( bih ) );<BR> bih.biSize = sizeof( bih );<BR> bih.biWidth = lWidth;<BR> bih.biHeight = lHeight;<BR> bih.biPlanes = 1;<BR> bih.biBitCount = 24;<BR>另附加一文。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:Jony 回复日期:2003-05-14 18:10:42
<br>内容:BOOL DisplayCapturedBits(BYTE *pBuffer, BITMAPINFOHEADER *pbih)<BR> {<BR> // If we haven't yet snapped a still, return<BR> if (!bFileWritten || !pOwner || !pBuffer)<BR> return FALSE;<BR><BR> // put bits into the preview window with StretchDIBits<BR> //<BR> HWND hwndStill = NULL;<BR> pOwner->GetDlgItem( IDC_STILL, &hwndStill );<BR><BR>// RECT rc;<BR>// ::GetWindowRect( hwndStill, &rc );<BR> ::SetWindowPos(hwndStill,HWND_TOP,4,0,XDIM,YDIM,SWP_SHOWWINDOW);<BR> long lStillWidth = XDIM;//rc.right - rc.left;<BR> long lStillHeight = YDIM;//rc.bottom - rc.top;<BR> <BR> HDC hdcStill = GetDC( hwndStill );<BR> PAINTSTRUCT ps;<BR> BeginPaint(hwndStill, &ps);<BR><BR> SetStretchBltMode(hdcStill, COLORONCOLOR);<BR> StretchDIBits( <BR> hdcStill, 0, 0, <BR> lStillWidth, lStillHeight, <BR> 0, 0, lWidth, lHeight, <BR> pBuffer, <BR> (BITMAPINFO*) pbih, <BR> DIB_RGB_COLORS, <BR> SRCCOPY );<BR><BR> EndPaint(hwndStill, &ps);<BR> ReleaseDC( hwndStill, hdcStill ); <BR><BR> return TRUE;<BR> }
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:flowingsky 回复日期:2003-05-15 18:01:14
<br>内容:使用缺省的像素格式时32位色是正常的,16位色不正常.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -