CCClippingRectangleNode,CCClippingNode源码解析

本文深入探讨了CCClippingNode和CCClippingRectangleNode的源码,揭示了它们在2D图形渲染中的工作原理,帮助开发者理解如何使用这些节点进行内容裁剪。
摘要由CSDN通过智能技术生成

源码:

/**
 *  @addtogroup _2d
 *  @{
 */
/** ClippingNode is a subclass of Node.
 * It draws its content (childs) clipped using a stencil.
 * The stencil is an other Node that will not be drawn.
 * The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).
 */
 /// 裁剪节点是节点的一个子类
 // 他通过一个模板来裁剪其子节点
 /// 这个模板是另一个将被绘制的节点
 /// 使用模板的alpha通道裁剪
class CC_DLL ClippingNode : public Node
{
public:
    /** Creates and initializes a clipping node without a stencil.
     *
     * @return An autorelease ClippingNode.
     */
	 /// 创建一个裁剪节点
    static ClippingNode* create();
    
    /** Creates and initializes a clipping node with an other node as its stencil.
     * The stencil node will be retained.
     * @param stencil The stencil node.
     */
	 /// 通过一个模板创建一个裁剪节点
    static ClippingNode* create(Node *stencil);

    /** The Node to use as a stencil to do the clipping.
     * The stencil node will be retained.
     * This default to nil.
     *
     * @return The stencil node.
     */
	 /// 得到模板
    Node* getStencil() const;
    
    /** Set the Node to use as a stencil to do the clipping.
     *
     * @param stencil The Node to use as a stencil to do the clipping.
     */
	 /// 设置模板
    void setStencil(Node *stencil);

    /** If stencil has no childre it
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值