---
title: "CCClippingNode裁剪功能"
author: "rayln"
date: "2013-12-04T22:20:30Z"
tags: []
categories: ["移动开发"]
slug: "ccclippingnode"
draft: false
lastmod: "2013-12-04T22:21:53Z"
id: 1985338
url: "https://rayln.iteye.com/blog/1985338"
---

**裁剪功能**

```c++

//裁剪的区域形状
CCSprite *area = CCSprite::create("/res/helloworld.png");
//被裁剪的区域
CCSprite *area1 = CCSprite::create("/res/helloworld.png");
this->addChild(area);

CCClipingNode *node = CCClipingNode::create(area);
node->addChild(area1);

node->setAlphaThreshold(0);
//裁剪反转
node->setInverted(true);
addChild(node);

```