?? ddbase.htm
字號:
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nXDest, //目標設備環境的矩形區域的左上角的x坐標</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nYDest, //目標設備環境的矩形區域的左上角的y坐標</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nWidth, //目標設備環境的矩形區域的寬度值</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nHeight, //目標設備環境的矩形區域的高度值</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">HDC hdcSrc, //源設備環境的句柄</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nXSrc, //源設備環境的矩形區域的左上角的x坐標</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">int nYSrc, //源設備環境的矩形區域的左上角的y坐標</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">DWORD dwRop //光柵操作符</font></p>
<p
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
color="#FFFFFF">);</font></p>
<p ALIGN="JUSTIFY"
style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"> </p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY"><font FACE="宋體" SIZE="3">dwRop參數是光柵操作代碼(Rop),它是指源位圖與目標位圖以及圖案刷的顏色值進行布爾運算的方式,以下列出了常用的光柵操作符。</p>
</font>
</blockquote>
<font FACE="宋體" SIZE="3"><div align="center"><center>
<table BORDER="1" CELLSPACING="0" CELLPADDING="7" WIDTH="559" style="margin-left: 40"
height="562">
<tr>
<td WIDTH="105" VALIGN="MIDDLE" HEIGHT="16"><b><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">光柵操作代碼</b></td>
<td WIDTH="418" VALIGN="MIDDLE" HEIGHT="16"><b><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">含義</b></td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">BLACKNESS</td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">用黑色填充目標矩形區域。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">DSTINVERT </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將目標矩形圖象進行反相。
</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">MERGECOPY </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象與指定的圖案刷(Pattern)進行布爾“與”運算。
</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">MERGEPAINT </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖形經過反相后,與目標矩形圖象進行布爾“或”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">NOTSRCCOPY </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象經過反相后,復制到目標矩形上。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="18"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">NOTSRCERASE </td>
<td WIDTH="418" VALIGN="TOP" height="18"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">先將源矩形圖象與目標矩形圖象進行布爾“或”運算,然后再將所得圖象進行反相。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">PATCOPY </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將指定的圖案刷復制到目標矩形上。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">PATINVERT</td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將指定的圖案刷與目標矩形圖象進行布爾“異或”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="32"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">PATPAINT</td>
<td WIDTH="418" VALIGN="TOP" height="32"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">先將源矩形圖象進行反相,與指定的圖案刷進行布爾“或”運算,再與目標矩形圖象進行布爾“或”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">SRCAND </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象與目標矩形圖象進行布爾“與”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">SRCCOPY </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象直接復制到目標矩形上。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">SRCERASE </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將目標矩形圖象進行反相,再與源矩形圖象進行布爾“與”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">SRCINVERT </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象與目標矩形圖象進行布爾“異或”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">SRCPAINT </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">將源矩形圖象與目標矩形圖象進行布爾“或”運算。</td>
</tr>
<tr>
<td WIDTH="105" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">WHITENESS </td>
<td WIDTH="418" VALIGN="TOP" height="16"><p ALIGN="JUSTIFY"
style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0">用白色填充目標矩形區域。</td>
</tr>
</table>
</center></div>
<blockquote>
<p ALIGN="JUSTIFY">表中,提到了三種的基本布爾運算,分別是:反相(NOT)、與(AND)、或(OR)。還提到了異或(XOR),學過數理邏輯的人都知道,異或運算其實也是可以由前三種組合出來的。可以看出,所有的光柵操作代碼都是由三種基本布爾運算組合而成。實際上,一共有256種光柵操作代碼,但最常用的就是以上這15種。若想使用這15種以外的任何一種時,可以查閱VC的幫助,但在實際中,它們是極少被用到的。</p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">圖案刷(英文是Pattern,
也可翻譯成模式刷,直接的意思是布料上圖案的花樣)是Windows資源的一種,屬于Brush,它其實是一個固定大小的位圖(通常為8x8像素),用來平鋪填充設備環境(DC)的某一區域。它的用法與普通的刷子是沒有區別的,當把一個圖案刷用SelectObject函數選定給某設備環境,再在該設備環境中進行填充操作,那么所填充的不是一個單純的顏色(選用普通的刷子時的情況),而是連續平鋪的圖案。</p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">GDI的blit函數還有PatBlt和StretchBlt。它們與BitBlt大同小異,BitBlt具有Patblt的所有功能,StretchBlt除了具有BitBlt的一切功能外,它還可以將位圖放大或縮小,實現縮放功能。</p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">DirectDraw最常用的blit函數是IDirectDrawSurface3::Blt,它的原型如下:</p>
</blockquote>
<blockquote>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
color="#FFFFFF">HRESULT IDirectDrawSurface3::Blt(</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
face="宋體" size="3" color="#FFFFFF">LPRECT lpDestRect, //目標矩形區</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
face="宋體" size="3" color="#FFFFFF">LPDIRECTDRAWSURFACE3 lpDDSrcSurface, //源頁面</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
face="宋體" size="3" color="#FFFFFF">LPRECT lpSrcRect, //源矩形區</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
face="宋體" size="3" color="#FFFFFF">DWORD dwFlags, //標志符</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
face="宋體" size="3" color="#FFFFFF">LPDDBLTFX lpDDBltFx //光柵操作代碼及特效</font></p>
<p style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2"><font
color="#FFFFFF">);</font></p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">DirectDraw中的Blt函數比GDI中的BitBlt函數雖然在形式上極為相似,但在內容上卻有了質的飛躍。首先,從運行速度上來比較,IDirectDrawSurface3::Blt可以利用到一切可以利用的硬件加速特性,而且該操作在缺省情況下是異步執行的,這意味著程序不需要等待blit結束才返回,而是在給系統發出了blit的指令后,立即返回,然后系統在后臺進行blit操作,這使程序的運行變得極為高效、快速;其次,它還支持帶源和目標關鍵色以及z緩存和alpha
通道的blit操作,這使得用該blit函數來完成各種效果變得極更為容易。</p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">該函數的目標頁面就是調用者本身,而且矩形區域用RECT結構表示。第四個參數dwFlays表示該blit操作的類型,最后一個參數lpDDBltFx是一個包含了光柵操作代碼和其它特效的結構,其中的光柵操作代碼成員與Win32的是兼容的。</p>
</blockquote>
<blockquote>
<p ALIGN="JUSTIFY">DirectDraw中的blit函數還有IDirectDrawSurface3::BltFast和IDirectDrawSurface3::
BltBatch。前者完成一次顯存中的blit操作,在沒有硬件加速的情況下,其速度可以較Blt快一些,后者完成一組blit操作。</p>
</blockquote>
<blockquote>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -