if (flags == RenderUpdateFlag::None) return sdata;
- //invisible?
- size_t a, sa;
- shape.fill(nullptr, nullptr, nullptr, &a);
- shape.strokeColor(nullptr, nullptr, nullptr, &sa);
- if (a == 0 && sa == 0) return sdata;
-
//TODO: Threading
SwSize clip = {static_cast<SwCoord>(surface.w), static_cast<SwCoord>(surface.h)};
//Shape
if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) {
- shapeReset(*sdata);
- if (!shapeGenOutline(shape, *sdata)) return sdata;
- if (transform) shapeTransformOutline(shape, *sdata, *transform);
- if (!shapeGenRle(shape, *sdata, clip)) return sdata;
+
+ size_t alpha = 0;
+ shape.fill(nullptr, nullptr, nullptr, &alpha);
+
+ if (alpha > 0) {
+ shapeReset(*sdata);
+ if (!shapeGenOutline(shape, *sdata)) return sdata;
+ if (transform) shapeTransformOutline(shape, *sdata, *transform);
+ if (!shapeGenRle(shape, *sdata, clip)) return sdata;
+ }
}
//Stroke
- if (flags & RenderUpdateFlag::Stroke) {
- shapeResetStroke(shape, *sdata);
- if (shape.strokeWidth() > 0.01) {
- if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata;
+ if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) {
+
+ if (shape.strokeWidth() > 0.5) {
+ shapeResetStroke(shape, *sdata);
+ size_t alpha = 0;
+ shape.strokeColor(nullptr, nullptr, nullptr, &alpha);
+ if (alpha > 0) {
+ if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata;
+ }
}
}
//fill property will be retained
shape->fill(127, 255, 255, 255);
+ shape->stroke(0, 0, 255, 255);
+ shape->stroke(1);
canvas->push(move(shape));
pShape->reset(); //reset path
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress));
+ pShape->stroke(30 * progress);
//Update shape for drawing (this may work asynchronously)
canvas->update(pShape);
//Prepare Round Rectangle (Scene1)
auto shape1 = tvg::Shape::gen();
shape1->appendRect(-235, -250, 400, 400, 50); //x, y, w, h, cornerRadius
- shape1->fill(0, 255, 0, 255); //r, g, b, a
+ shape1->fill(0, 255, 0, 255); //r, g, b, a
+ shape1->stroke(5); //width
+ shape1->stroke(255, 255, 255, 255); //r, g, b, a
scene->push(move(shape1));
//Prepare Circle (Scene1)
auto shape2 = tvg::Shape::gen();
shape2->appendCircle(-165, -150, 200, 200); //cx, cy, radiusW, radiusH
- shape2->fill(255, 255, 0, 255); //r, g, b, a
+ shape2->fill(255, 255, 0, 255); //r, g, b, a
scene->push(move(shape2));
//Prepare Ellipse (Scene1)
auto shape3 = tvg::Shape::gen();
- shape3->appendCircle(265, 250, 150, 100); //cx, cy, radiusW, radiusH
- shape3->fill(0, 255, 255, 255); //r, g, b, a
+ shape3->appendCircle(265, 250, 150, 100); //cx, cy, radiusW, radiusH
+ shape3->fill(0, 255, 255, 255); //r, g, b, a
scene->push(move(shape3));
scene->translate(350, 350);
shape4->lineTo(-53, -5.5);
shape4->close();
shape4->fill(0, 0, 127, 127);
+ shape4->stroke(3); //width
+ shape4->stroke(0, 0, 255, 255); //r, g, b, a
scene2->push(move(shape4));
//Circle (Scene2)