自己加個自我解析吧。第三個函數,SelectClipPath()的意思是在設定一個路徑層中之後,把路徑層當作一個剪貼地區,這樣就能和別的在同樣地區顯示的內容利用模式進行操作!
在MFC中,路徑層主要運用於在視窗中繪圖。 學過Photoshop的同學都知道,我們在設計一張海報時,可能會用到多張圖片進行合成,而在合成之前是要對每張圖片進行各自處理的。這個時候我們就要給每一張圖片定製一個它專屬的處理空間---路徑層。在各個獨立的空間---路徑層上,我們對每張圖片進行處理而互相不受影響。 類似地,MFC中,在一塊視窗上我們也可以定製多個路徑層並在各個路徑層上進行繪圖或輸出字元的操作。 MFC中,我們利用CDC類提供的成員函數BeginPath()和EndPath()這兩個函數來實現一個路徑層的建立。(一) CDC::BeginPathBOOL BeginPath( ); Return Value Nonzero if the function is successful; otherwise 0.//如果開啟路徑層成功則傳回值為一個非零值,否則返回0; Remarks Opens a path bracket in the device context. After a path bracket is open, an application can begin calling GDI drawing functions to define the points that lie in the path. An application can close an open path bracket by calling the EndPath member function. When an application calls BeginPath, any previous paths are discarded. //在裝置描述表中開啟一個路勁層,一個路徑層開啟後,應用程式就可以調用GDI函數(圖形裝置介面函數),去設定處在這個路徑層中的點,應用程式通過調用EndPath函數將路徑層關閉。當應用程式調用BeginPath的時候,之前的路徑就會被棄置不理。 (二) CDC::EndPath BOOL EndPath( ); Return Value Nonzero if the function is successful; otherwise 0..//如果關閉路徑層成功則傳回值為一個非零值,否則返回0; Remarks Closes a path bracket and selects the path defined by the bracket into the device context. //用於關閉一個路徑層,並且將由這個路徑層定義的路徑選入裝置描述表當中 在繪圖時,如果希望圖的某一部分與其他部分分開處理,就可以利用路徑層的獨立性 (三)CDC::SelectClipPathBOOL SelectClipPath( int nMode );//此函數的作用是將所建立的路徑層作為一個剪輯地區,將原來的路徑層作為另一個剪輯地區,然後對這兩個地區進行取交集、並集的操作得到一個新的剪輯地區,並在這個新的剪輯地區裡進行互操作。Return Value Nonzero if the function is successful; otherwise 0.//函數成功傳回值為非零,否則為0; Parameters nMode //函數形參可取如下值 Specifies the way to use the path. The following values are allowed: //指定使用路徑的方式,以下值是可取的
- RGN_AND The new clipping
region includes the intersection (overlapping areas) of the current clipping region and the current path.
- //交集,也就是說,如果在兩個剪輯地區裡面都有作圖的話,最後的效果是只在剪輯區的交集處顯示圖形
- RGN_COPY The new clipping
region is the current path.
- //新的剪輯區就是建立路徑層上的剪輯區
- RGN_DIFF The new clipping
region includes the areas of the current clipping region, and those of the current path are excluded.
- //新的剪下區是舊的剪下區中除去路徑層的部分
- RGN_OR The new clipping region
includes the union (combined areas) of the current clipping region and the current path.
- //新的剪下區是舊的剪下區和路徑層的並集
- RGN_XOR The new clipping
region includes the union of the current clipping region and the current path, but without the overlapping areas.
- //新的剪下區是舊的剪下區和路徑層的並集,但除去他們的交集部分
Remarks Selects the current path as a clipping region for the device context, combining the new region with any existing clipping region by using the specified mode. The device context identified must contain a closed path. |