How to paint shapes

How to paint shapes
0

#1

I drew a rounded rectangle with a line. I want to fill this. please tell me.
Thanks

auto roundCorner = DrawNode::create();
roundCorner->drawCubicBezier(originTL, control1TL, control2TL, destinationTL, 10, Color4F::RED);
roundCorner->drawCubicBezier(originTR, control1TR, control2TR, destinationTR, 10, Color4F::GREEN);
roundCorner->drawCubicBezier(originBR, control1BR, control2BR, destinationBR, 10, Color4F::YELLOW);
roundCorner->drawCubicBezier(originBL, control1BL, control2BL, destinationBL, 10, Color4F::WHITE);
this->addChild(roundCorner, 0);


#2

If you don’t need a dynamic Bezier then maybe you should use a Scale9Sprite (with Texture). Simplest way.
or
you use drawSolidPoly (take the vertices of a Bezier Curve)
or
have a look how the cocos2dx have implemented filled shape “drawSolidPoly”
ooor :slight_smile:
combine shapes like Rects and circles to achieve a rounded rect (dirty way)