MFC中的路径层

本文来源于:http://blog.csdn.net/tobykentrunzhi/article/details/6974259

SelectClipPath()的意思是在设置一个路径层中之后,把路径层当作一个剪贴区域,这样就能和别的在同样区域显示的内容利用模式进行操作!

 

在MFC中,路径层主要运用于在窗口中绘图。


   学过Photoshop的同学都知道,我们在设计一张海报时,可能会用到多张图片进行合成,而在合成之前是要对每张图片进行各自处理的。这个时候我们就要给每一张图片定制一个它独有的处理空间---路径层。在各个独立的空间---路径层上,我们对每张图片进行处理而互相不受影响。

   类似地,MFC中,在一块窗口上我们也可以定制多个路径层并在各个路径层上进行绘图或输出字符的操作。

   MFC中,我们利用CDC类提供的成员函数BeginPath()和EndPath()这两个函数来实现一个路径层的创建。

(一) 

CDC::BeginPath

BOOL 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 drawingfunctions to define the points that lie in the path. An application can closean open path bracket by calling the EndPath memberfunction. When an application calls BeginPath,any previous paths are discarded.

//在设备描述表中打开一个路劲层,一个路径层打开后,应用程序就可以调用GDI函数(图形设备接口函数),去设置处在这个路径层中的点,应用程序通过调用EndPath函数将路径层关闭。当应用程序调用BeginPath的时候,之前的路径就会被弃置不理。

(二)

CDC::EndPath

BOOL EndPath( );

Return Value

Nonzeroif the function is successful; otherwise 0..//如果关闭路径层成功则返回值为一个非零值,否则返回0

Remarks

Closesa path bracket and selects the path defined by the bracket into the devicecontext.

//用于关闭一个路径层,并且将由这个路径层定义的路径选入设备描述表当中

 

 

 

 

在绘图时,如果希望图的某一部分与其他部分分开处理,就可以利用路径层的独立性

 (三)

CDC::SelectClipPath

BOOL SelectClipPath( int nMode );//此函数的作用是将所建立的路径层作为一个剪辑区域,将原来的路径层作为另一个剪辑区域,然后对这两个区域进行取交集、并集的操作得到一个新的剪辑区域,并在这个新的剪辑区域里进行互操作。

Return Value

Nonzero if the function is successful;otherwise 0.//函数成功返回值为非零,否则为0

 

Parameters

nMode              //函数形参可取如下值

Specifies the way to use the path. Thefollowing values are allowed:

//指定使用路径的方式,以下值是可取的

·       RGN_AND   The new clippingregion includes the intersection (overlapping areas) of the current clippingregion and the current path.

·       //交集,也就是说,如果在两个剪辑区域里面都有作图的话,最后的效果是只在剪辑区的交集处显示图形

·       RGN_COPY   The new clippingregion is the current path.

·       //新的剪辑区就是新建路径层上的剪辑区

·       RGN_DIFF   The new clippingregion includes the areas of the current clipping region, and those of thecurrent path are excluded.

·       //新的剪切区是旧的剪切区中除去路径层的部分

·       RGN_OR   The new clippingregion includes the union (combined areas) of the current clipping region andthe current path.

·       //新的剪切区是旧的剪切区和路径层的并集

RGN_XOR    The new clipping region includes the union of thecurrent clipping region and the current path, but without the overlappingareas.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值