clipNodetest:function()
{
this.clipNode=new cc.ClippingNode();//创建剪裁node
this.clipNode.setPosition(200,200);
this.clipNode.setAlphaThreshold(1); //设置绘制底板的Alpha值为1,遮罩形状的像素为透明
this.stencilNode=new cc.Node();//创建模板node
this.stencilNode.retain();
var sp=new cc.Sprite(res.c1_png);//创建遮罩精灵
var sp1=new cc.Sprite(res.c1_png);//创建遮罩精灵
sp.addChild(sp1);//添加子sprite,这句注释掉的话剪裁效果是正常的
sp1.setPosition(80,80);
var spShow=new cc.Sprite(res.t1_jpg);//创建底板精灵
var spBg=new cc.Sprite(res.index_jpg);//创建底板精灵
spShow.scale=1;
var hole=new cc.Node();
//this.clipNode.addChild(hole);
this.clipNode.addChild(spShow);//设置底板
//this.clipNode.stencil=sp;//设置模板--------------------
this.stencilNode.setOpacity(255);
this.stencilNode.setContentSize(new cc.Size(200,200));
//this.stencilNode.addChild(sp);
this.clipNode.setStencil(sp);//sp添加了子sprite后显示不出来,不添加的话显示正常
//this.clipNode.setInverted(true);//剪切反转有2个child sprite的模板显示正常,没有反转的话显示不正常
//this.clipNode.inverted = true;
this.clipNode.retain();
//this.clipNode.alphaThreshold=0.5;
spBg.setPosition(200,200);
this.addChild(spBg,3);
this.addChild(this.clipNode,4);
this.textLabel.setString("Hello World 94");
// this.addChild(spShow1);
},



