Cocos2dx version 3.8.1
I am using ClippingNode to round an image for profile image. here is the code.
auto stencil = DrawNode::create();
static Color4F mask = {0, 0, 0, 1};
stencil->setPosition(Point(imageMain->getBoundingBox().size.width/4, imageMain->getBoundingBox().size.height/4));
// Create the clipping node with stencil buffer
auto clipper = ClippingNode::create();
clipper->setAnchorPoint(Point(0.5, 0.5));
clipper->setContentSize(Size::ZERO);
clipper->setInverted(false);
clipper->setStencil(stencil);
this->addChild(clipper,3);
stencil->drawSolidCircle(Vec2(clipper->getBoundingBox().size.width / 2,
clipper->getBoundingBox().size.height / 2), imageMain->getBoundingBox().size.width/2, 0, 360, Color4F::MAGENTA);
clipper->addChild(imageMain);
clipper->setPosition(imageMain->getBoundingBox().size.width/4,imageMain->getBoundingBox().size.width/4);
While using it in tableView its working fine but if i use it in Layout its behave strange like if i add it on right side , the left side objects added after that rounded image are not showing.
tried this code for enable clipping in layout
layout->setClippingEnabled(true);
but doesn’t work even.
And if i add another sprite in it is shows behind that rounded image …
I don’t know it’s a cocos2dx issue or i miss some thing