Canvas(RenderMethod*);
virtual ~Canvas();
+ int reserve(size_t n);
virtual int push(std::unique_ptr<PaintNode> paint) noexcept;
virtual int clear() noexcept;
virtual int update() noexcept;
}
+int Canvas::reserve(size_t n)
+{
+ auto impl = pImpl.get();
+ assert(impl);
+ return impl->reserve(n);
+}
+
+
int Canvas::push(unique_ptr<PaintNode> paint) noexcept
{
auto impl = pImpl.get();
//Create a Canvas
auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
- //canvas->reserve(2); //reserve 2 shape nodes (optional)
+ canvas->reserve(3); //reserve 3 shape nodes (optional)
//Prepare Round Rectangle
auto shape1 = tvg::ShapeNode::gen();
//Prepare a Shape (Rectangle)
auto shape1 = tvg::ShapeNode::gen();
- shape1->appendRect(0, 0, 400, 400, 0); //x, y, w, h, cornerRadius
+ shape1->appendRect(100, 100, 400, 400, 0); //x, y, w, h, cornerRadius
shape1->fill(255, 0, 0, 255); //r, g, b, a
/* Push the shape into the Canvas drawing list