mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
renamed stroke apis family.
float Shape::stroke(float width) -> float Shape::strokeWidth(float width) Result Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) -> Result Shape::strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) Result Shape::stroke(std::unique_ptr<Fill> f) -> Result Shape::strokeFill(std::unique_ptr<Fill> f) Result Shape::stroke(const float* dashPattern, uint32_t cnt, float offset = 0.0f) -> Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f) Result Shape::stroke(StrokeCap cap) -> Result Shape::strokeCap(StrokeCap cap) Result Shape::stroke(StrokeJoin join) -> Result Shape::strokeJoin(StrokeJoin join) Result Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const -> Result Shape::strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const @Issue: https://github.com/thorvg/thorvg/issues/1372
This commit is contained in:
parent
989b995189
commit
db55481e97
33 changed files with 244 additions and 246 deletions
14
inc/thorvg.h
14
inc/thorvg.h
|
@ -946,7 +946,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
||||||
*/
|
*/
|
||||||
Result stroke(float width) noexcept;
|
Result strokeWidth(float width) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the color of the stroke for all of the figures from the path.
|
* @brief Sets the color of the stroke for all of the figures from the path.
|
||||||
|
@ -958,7 +958,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
||||||
*/
|
*/
|
||||||
Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
|
Result strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the gradient fill of the stroke for all of the figures from the path.
|
* @brief Sets the gradient fill of the stroke for all of the figures from the path.
|
||||||
|
@ -969,7 +969,7 @@ public:
|
||||||
* @retval Result::FailedAllocation An internal error with a memory allocation for an object to be filled.
|
* @retval Result::FailedAllocation An internal error with a memory allocation for an object to be filled.
|
||||||
* @retval Result::MemoryCorruption In case a @c nullptr is passed as the argument.
|
* @retval Result::MemoryCorruption In case a @c nullptr is passed as the argument.
|
||||||
*/
|
*/
|
||||||
Result stroke(std::unique_ptr<Fill> f) noexcept;
|
Result strokeFill(std::unique_ptr<Fill> f) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the dash pattern of the stroke.
|
* @brief Sets the dash pattern of the stroke.
|
||||||
|
@ -984,7 +984,7 @@ public:
|
||||||
* @note To reset the stroke dash pattern, pass @c nullptr to @p dashPattern and zero to @p cnt.
|
* @note To reset the stroke dash pattern, pass @c nullptr to @p dashPattern and zero to @p cnt.
|
||||||
* @warning @p cnt must be greater than 1 if the dash pattern is valid.
|
* @warning @p cnt must be greater than 1 if the dash pattern is valid.
|
||||||
*/
|
*/
|
||||||
Result stroke(const float* dashPattern, uint32_t cnt) noexcept;
|
Result strokeDash(const float* dashPattern, uint32_t cnt) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the cap style of the stroke in the open sub-paths.
|
* @brief Sets the cap style of the stroke in the open sub-paths.
|
||||||
|
@ -993,7 +993,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
||||||
*/
|
*/
|
||||||
Result stroke(StrokeCap cap) noexcept;
|
Result strokeCap(StrokeCap cap) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the join style for stroked path segments.
|
* @brief Sets the join style for stroked path segments.
|
||||||
|
@ -1004,7 +1004,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
* @return Result::Success when succeed, Result::FailedAllocation otherwise.
|
||||||
*/
|
*/
|
||||||
Result stroke(StrokeJoin join) noexcept;
|
Result strokeJoin(StrokeJoin join) noexcept;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1131,7 +1131,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Result::Success when succeed, Result::InsufficientCondition otherwise.
|
* @return Result::Success when succeed, Result::InsufficientCondition otherwise.
|
||||||
*/
|
*/
|
||||||
Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
|
Result strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the pointer to the gradient fill of the stroke.
|
* @brief Gets the pointer to the gradient fill of the stroke.
|
||||||
|
|
|
@ -334,7 +334,7 @@ TVG_API Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width)
|
TVG_API Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(width);
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeWidth(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,28 +349,28 @@ TVG_API Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* wid
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
TVG_API Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(r, g, b, a);
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeFill(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
TVG_API Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<const Shape*>(paint)->strokeColor(r, g, b, a);
|
return (Tvg_Result) reinterpret_cast<const Shape*>(paint)->strokeFill(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
TVG_API Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(unique_ptr<LinearGradient>((LinearGradient*)(gradient)));
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeFill(unique_ptr<LinearGradient>((LinearGradient*)(gradient)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
TVG_API Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(unique_ptr<RadialGradient>((RadialGradient*)(gradient)));
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeFill(unique_ptr<RadialGradient>((RadialGradient*)(gradient)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ TVG_API Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gra
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt)
|
TVG_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(dashPattern, cnt);
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeDash(dashPattern, cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ TVG_API Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap)
|
TVG_API Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke((StrokeCap)cap);
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeCap((StrokeCap)cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ TVG_API Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_C
|
||||||
TVG_API Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join)
|
TVG_API Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join)
|
||||||
{
|
{
|
||||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke((StrokeJoin)join);
|
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->strokeJoin((StrokeJoin)join);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
pMaskShape = maskShape.get();
|
pMaskShape = maskShape.get();
|
||||||
maskShape->appendCircle(180, 180, 75, 75);
|
maskShape->appendCircle(180, 180, 75, 75);
|
||||||
maskShape->fill(125, 125, 125);
|
maskShape->fill(125, 125, 125);
|
||||||
maskShape->stroke(25, 25, 25);
|
maskShape->strokeFill(25, 25, 25);
|
||||||
maskShape->stroke(tvg::StrokeJoin::Round);
|
maskShape->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
maskShape->stroke(10);
|
maskShape->strokeWidth(10);
|
||||||
canvas->push(std::move(maskShape));
|
canvas->push(std::move(maskShape));
|
||||||
|
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
|
|
@ -33,61 +33,61 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
//Arc Line
|
//Arc Line
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendArc(150, 150, 80, 10, 180, false);
|
shape1->appendArc(150, 150, 80, 10, 180, false);
|
||||||
shape1->stroke(255, 255, 255);
|
shape1->strokeFill(255, 255, 255);
|
||||||
shape1->stroke(2);
|
shape1->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendArc(400, 150, 80, 0, 300, false);
|
shape2->appendArc(400, 150, 80, 0, 300, false);
|
||||||
shape2->stroke(255, 255, 255);
|
shape2->strokeFill(255, 255, 255);
|
||||||
shape2->stroke(2);
|
shape2->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->appendArc(600, 150, 80, 300, 60, false);
|
shape3->appendArc(600, 150, 80, 300, 60, false);
|
||||||
shape3->stroke(255, 255, 255);
|
shape3->strokeFill(255, 255, 255);
|
||||||
shape3->stroke(2);
|
shape3->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Pie Line
|
//Pie Line
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
shape4->appendArc(150, 400, 80, 10, 180, true);
|
shape4->appendArc(150, 400, 80, 10, 180, true);
|
||||||
shape4->stroke(255, 255, 255);
|
shape4->strokeFill(255, 255, 255);
|
||||||
shape4->stroke(2);
|
shape4->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendArc(400, 400, 80, 0, 300, true);
|
shape5->appendArc(400, 400, 80, 0, 300, true);
|
||||||
shape5->stroke(255, 255, 255);
|
shape5->strokeFill(255, 255, 255);
|
||||||
shape5->stroke(2);
|
shape5->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape6 = tvg::Shape::gen();
|
auto shape6 = tvg::Shape::gen();
|
||||||
shape6->appendArc(600, 400, 80, 300, 60, true);
|
shape6->appendArc(600, 400, 80, 300, 60, true);
|
||||||
shape6->stroke(255, 255, 255);
|
shape6->strokeFill(255, 255, 255);
|
||||||
shape6->stroke(2);
|
shape6->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Pie Fill
|
//Pie Fill
|
||||||
auto shape7 = tvg::Shape::gen();
|
auto shape7 = tvg::Shape::gen();
|
||||||
shape7->appendArc(150, 650, 80, 10, 180, true);
|
shape7->appendArc(150, 650, 80, 10, 180, true);
|
||||||
shape7->fill(255, 255, 255);
|
shape7->fill(255, 255, 255);
|
||||||
shape7->stroke(255, 0, 0);
|
shape7->strokeFill(255, 0, 0);
|
||||||
shape7->stroke(2);
|
shape7->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape7)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape7)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape8 = tvg::Shape::gen();
|
auto shape8 = tvg::Shape::gen();
|
||||||
shape8->appendArc(400, 650, 80, 0, 300, true);
|
shape8->appendArc(400, 650, 80, 0, 300, true);
|
||||||
shape8->fill(255, 255, 255);
|
shape8->fill(255, 255, 255);
|
||||||
shape8->stroke(255, 0, 0);
|
shape8->strokeFill(255, 0, 0);
|
||||||
shape8->stroke(2);
|
shape8->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape8)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape8)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape9 = tvg::Shape::gen();
|
auto shape9 = tvg::Shape::gen();
|
||||||
shape9->appendArc(600, 650, 80, 300, 60, true);
|
shape9->appendArc(600, 650, 80, 300, 60, true);
|
||||||
shape9->fill(255, 255, 255);
|
shape9->fill(255, 255, 255);
|
||||||
shape9->stroke(255, 0, 0);
|
shape9->strokeFill(255, 0, 0);
|
||||||
shape9->stroke(2);
|
shape9->strokeWidth(2);
|
||||||
if (canvas->push(std::move(shape9)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape9)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto star1 = tvg::Shape::gen();
|
auto star1 = tvg::Shape::gen();
|
||||||
tvgDrawStar(star1.get());
|
tvgDrawStar(star1.get());
|
||||||
star1->fill(255, 255, 0);
|
star1->fill(255, 255, 0);
|
||||||
star1->stroke(255 ,0, 0);
|
star1->strokeFill(255 ,0, 0);
|
||||||
star1->stroke(10);
|
star1->strokeWidth(10);
|
||||||
|
|
||||||
//Move Star1
|
//Move Star1
|
||||||
star1->translate(-10, -10);
|
star1->translate(-10, -10);
|
||||||
|
@ -72,8 +72,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto star2 = tvg::Shape::gen();
|
auto star2 = tvg::Shape::gen();
|
||||||
tvgDrawStar(star2.get());
|
tvgDrawStar(star2.get());
|
||||||
star2->fill(0, 255, 255);
|
star2->fill(0, 255, 255);
|
||||||
star2->stroke(0 ,255, 0);
|
star2->strokeFill(0 ,255, 0);
|
||||||
star2->stroke(10);
|
star2->strokeWidth(10);
|
||||||
star2->opacity(100);
|
star2->opacity(100);
|
||||||
|
|
||||||
//Move Star2
|
//Move Star2
|
||||||
|
@ -105,8 +105,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
fill->colorStops(colorStops, 2);
|
fill->colorStops(colorStops, 2);
|
||||||
star3->fill(std::move(fill));
|
star3->fill(std::move(fill));
|
||||||
|
|
||||||
star3->stroke(255 ,0, 0);
|
star3->strokeFill(255 ,0, 0);
|
||||||
star3->stroke(10);
|
star3->strokeWidth(10);
|
||||||
star3->translate(400, 0);
|
star3->translate(400, 0);
|
||||||
|
|
||||||
// color/alpha/opacity are ignored for a clip object - no need to set them
|
// color/alpha/opacity are ignored for a clip object - no need to set them
|
||||||
|
|
|
@ -47,8 +47,8 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
shape->lineTo(-53, -5.5);
|
shape->lineTo(-53, -5.5);
|
||||||
shape->close();
|
shape->close();
|
||||||
shape->fill(0, 0, 255);
|
shape->fill(0, 0, 255);
|
||||||
shape->stroke(3);
|
shape->strokeWidth(3);
|
||||||
shape->stroke(255, 255, 255);
|
shape->strokeFill(255, 255, 255);
|
||||||
|
|
||||||
//Transform Matrix
|
//Transform Matrix
|
||||||
tvg::Matrix m = {1, 0, 0, 0, 1, 0, 0, 0, 1};
|
tvg::Matrix m = {1, 0, 0, 0, 1, 0, 0, 0, 1};
|
||||||
|
|
|
@ -51,8 +51,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
//fill property will be retained
|
//fill property will be retained
|
||||||
shape->fill(127, 255, 255);
|
shape->fill(127, 255, 255);
|
||||||
shape->stroke(0, 0, 255);
|
shape->strokeFill(0, 0, 255);
|
||||||
shape->stroke(1);
|
shape->strokeWidth(1);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
if (pShape->reset() == tvg::Result::Success) {
|
if (pShape->reset() == tvg::Result::Success) {
|
||||||
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress), (100 * progress));
|
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress), (100 * progress));
|
||||||
pShape->fill(127, 255, 255);
|
pShape->fill(127, 255, 255);
|
||||||
pShape->stroke(0, 0, 255);
|
pShape->strokeFill(0, 0, 255);
|
||||||
pShape->stroke(30 * progress);
|
pShape->strokeWidth(30 * progress);
|
||||||
|
|
||||||
//Update shape for drawing (this may work asynchronously)
|
//Update shape for drawing (this may work asynchronously)
|
||||||
canvas->update(pShape);
|
canvas->update(pShape);
|
||||||
|
|
|
@ -38,11 +38,11 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->appendRect(10, 10, 200, 200);
|
shape1->appendRect(10, 10, 200, 200);
|
||||||
shape1->appendRect(220, 10, 100, 100);
|
shape1->appendRect(220, 10, 100, 100);
|
||||||
|
|
||||||
shape1->stroke(3);
|
shape1->strokeWidth(3);
|
||||||
shape1->stroke(0, 255, 0);
|
shape1->strokeFill(0, 255, 0);
|
||||||
|
|
||||||
float dashPattern[2] = {4, 4};
|
float dashPattern[2] = {4, 4};
|
||||||
shape1->stroke(dashPattern, 2);
|
shape1->strokeDash(dashPattern, 2);
|
||||||
shape1->fill(255, 0, 0);
|
shape1->fill(255, 0, 0);
|
||||||
|
|
||||||
//Duplicate Shape, Switch fill method
|
//Duplicate Shape, Switch fill method
|
||||||
|
|
|
@ -60,15 +60,15 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->lineTo(100, 150);
|
shape1->lineTo(100, 150);
|
||||||
shape1->close();
|
shape1->close();
|
||||||
|
|
||||||
shape1->stroke(0, 255, 0);
|
shape1->strokeFill(0, 255, 0);
|
||||||
shape1->stroke(20);
|
shape1->strokeWidth(20);
|
||||||
shape1->stroke(tvg::StrokeJoin::Miter);
|
shape1->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape1->stroke(tvg::StrokeCap::Butt);
|
shape1->strokeCap(tvg::StrokeCap::Butt);
|
||||||
|
|
||||||
auto fillStroke1 = tvg::LinearGradient::gen();
|
auto fillStroke1 = tvg::LinearGradient::gen();
|
||||||
fillStroke1->linear(100, 100, 250, 250);
|
fillStroke1->linear(100, 100, 250, 250);
|
||||||
fillStroke1->colorStops(colorStops1, 3);
|
fillStroke1->colorStops(colorStops1, 3);
|
||||||
shape1->stroke(std::move(fillStroke1));
|
shape1->strokeFill(std::move(fillStroke1));
|
||||||
|
|
||||||
auto fill1 = tvg::LinearGradient::gen();
|
auto fill1 = tvg::LinearGradient::gen();
|
||||||
fill1->linear(100, 100, 250, 250);
|
fill1->linear(100, 100, 250, 250);
|
||||||
|
@ -80,12 +80,12 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
// radial gradient stroke + duplicate
|
// radial gradient stroke + duplicate
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendCircle(600, 175, 100, 60);
|
shape2->appendCircle(600, 175, 100, 60);
|
||||||
shape2->stroke(80);
|
shape2->strokeWidth(80);
|
||||||
|
|
||||||
auto fillStroke2 = tvg::RadialGradient::gen();
|
auto fillStroke2 = tvg::RadialGradient::gen();
|
||||||
fillStroke2->radial(600, 175, 100);
|
fillStroke2->radial(600, 175, 100);
|
||||||
fillStroke2->colorStops(colorStops2, 2);
|
fillStroke2->colorStops(colorStops2, 2);
|
||||||
shape2->stroke(std::move(fillStroke2));
|
shape2->strokeFill(std::move(fillStroke2));
|
||||||
|
|
||||||
auto shape3 = tvg::cast<tvg::Shape>(shape2->duplicate());
|
auto shape3 = tvg::cast<tvg::Shape>(shape2->duplicate());
|
||||||
shape3->translate(0, 200);
|
shape3->translate(0, 200);
|
||||||
|
@ -93,7 +93,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto fillStroke3 = tvg::LinearGradient::gen();
|
auto fillStroke3 = tvg::LinearGradient::gen();
|
||||||
fillStroke3->linear(500, 115, 700, 235);
|
fillStroke3->linear(500, 115, 700, 235);
|
||||||
fillStroke3->colorStops(colorStops3, 2);
|
fillStroke3->colorStops(colorStops3, 2);
|
||||||
shape3->stroke(std::move(fillStroke3));
|
shape3->strokeFill(std::move(fillStroke3));
|
||||||
|
|
||||||
auto shape4 = tvg::cast<tvg::Shape>(shape2->duplicate());
|
auto shape4 = tvg::cast<tvg::Shape>(shape2->duplicate());
|
||||||
shape4->translate(0, 400);
|
shape4->translate(0, 400);
|
||||||
|
@ -106,13 +106,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendRect(100, 500, 300, 300, 50, 80);
|
shape5->appendRect(100, 500, 300, 300, 50, 80);
|
||||||
|
|
||||||
shape5->stroke(20);
|
shape5->strokeWidth(20);
|
||||||
shape5->stroke(dashPattern1, 2);
|
shape5->strokeDash(dashPattern1, 2);
|
||||||
shape5->stroke(tvg::StrokeCap::Butt);
|
shape5->strokeCap(tvg::StrokeCap::Butt);
|
||||||
auto fillStroke5 = tvg::LinearGradient::gen();
|
auto fillStroke5 = tvg::LinearGradient::gen();
|
||||||
fillStroke5->linear(150, 450, 450, 750);
|
fillStroke5->linear(150, 450, 450, 750);
|
||||||
fillStroke5->colorStops(colorStops3, 2);
|
fillStroke5->colorStops(colorStops3, 2);
|
||||||
shape5->stroke(std::move(fillStroke5));
|
shape5->strokeFill(std::move(fillStroke5));
|
||||||
|
|
||||||
auto fill5 = tvg::LinearGradient::gen();
|
auto fill5 = tvg::LinearGradient::gen();
|
||||||
fill5->linear(150, 450, 450, 750);
|
fill5->linear(150, 450, 450, 750);
|
||||||
|
|
|
@ -79,8 +79,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
star->lineTo(426, 161);
|
star->lineTo(426, 161);
|
||||||
star->lineTo(546, 143);
|
star->lineTo(546, 143);
|
||||||
star->close();
|
star->close();
|
||||||
star->stroke(10);
|
star->strokeWidth(10);
|
||||||
star->stroke(255, 255, 255);
|
star->strokeFill(255, 255, 255);
|
||||||
|
|
||||||
//Mask3
|
//Mask3
|
||||||
auto mask3 = tvg::Shape::gen();
|
auto mask3 = tvg::Shape::gen();
|
||||||
|
|
|
@ -79,8 +79,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
star->lineTo(426, 161);
|
star->lineTo(426, 161);
|
||||||
star->lineTo(546, 143);
|
star->lineTo(546, 143);
|
||||||
star->close();
|
star->close();
|
||||||
star->stroke(10);
|
star->strokeWidth(10);
|
||||||
star->stroke(255, 255, 255);
|
star->strokeFill(255, 255, 255);
|
||||||
|
|
||||||
//Mask3
|
//Mask3
|
||||||
auto mask3 = tvg::Shape::gen();
|
auto mask3 = tvg::Shape::gen();
|
||||||
|
|
|
@ -79,8 +79,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
star->lineTo(426, 161);
|
star->lineTo(426, 161);
|
||||||
star->lineTo(546, 143);
|
star->lineTo(546, 143);
|
||||||
star->close();
|
star->close();
|
||||||
star->stroke(10);
|
star->strokeWidth(10);
|
||||||
star->stroke(255, 255, 255);
|
star->strokeFill(255, 255, 255);
|
||||||
|
|
||||||
//Mask3
|
//Mask3
|
||||||
auto mask3 = tvg::Shape::gen();
|
auto mask3 = tvg::Shape::gen();
|
||||||
|
|
|
@ -79,9 +79,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
star->lineTo(426, 161);
|
star->lineTo(426, 161);
|
||||||
star->lineTo(546, 143);
|
star->lineTo(546, 143);
|
||||||
star->close();
|
star->close();
|
||||||
star->stroke(30);
|
star->strokeWidth(30);
|
||||||
star->stroke(tvg::StrokeJoin::Miter);
|
star->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
star->stroke(255, 255, 255);
|
star->strokeFill(255, 255, 255);
|
||||||
|
|
||||||
//Mask3
|
//Mask3
|
||||||
auto mask3 = tvg::Shape::gen();
|
auto mask3 = tvg::Shape::gen();
|
||||||
|
|
|
@ -44,8 +44,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendRect(450, 100, 200, 200, 50, 50);
|
shape2->appendRect(450, 100, 200, 200, 50, 50);
|
||||||
shape2->fill(0, 255, 0);
|
shape2->fill(0, 255, 0);
|
||||||
shape2->stroke(10);
|
shape2->strokeWidth(10);
|
||||||
shape2->stroke(255, 255, 255);
|
shape2->strokeFill(255, 255, 255);
|
||||||
scene->push(std::move(shape2));
|
scene->push(std::move(shape2));
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->lineTo(146, 143);
|
shape3->lineTo(146, 143);
|
||||||
shape3->close();
|
shape3->close();
|
||||||
shape3->fill(0, 0, 255);
|
shape3->fill(0, 0, 255);
|
||||||
shape3->stroke(10);
|
shape3->strokeWidth(10);
|
||||||
shape3->stroke(255, 255, 255);
|
shape3->strokeFill(255, 255, 255);
|
||||||
shape3->opacity(127);
|
shape3->opacity(127);
|
||||||
|
|
||||||
scene2->push(std::move(shape3));
|
scene2->push(std::move(shape3));
|
||||||
|
@ -95,8 +95,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape4->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
shape4->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
||||||
shape4->close();
|
shape4->close();
|
||||||
shape4->fill(255, 0, 0);
|
shape4->fill(255, 0, 0);
|
||||||
shape4->stroke(10);
|
shape4->strokeWidth(10);
|
||||||
shape4->stroke(0, 0, 255);
|
shape4->strokeFill(0, 0, 255);
|
||||||
shape4->opacity(200);
|
shape4->opacity(200);
|
||||||
shape4->scale(3);
|
shape4->scale(3);
|
||||||
scene2->push(std::move(shape4));
|
scene2->push(std::move(shape4));
|
||||||
|
|
|
@ -54,15 +54,15 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
shape4->appendCircle(400, 400, 100, 100);
|
shape4->appendCircle(400, 400, 100, 100);
|
||||||
shape4->fill(255, 0, 0);
|
shape4->fill(255, 0, 0);
|
||||||
shape4->stroke(5);
|
shape4->strokeWidth(5);
|
||||||
shape4->stroke(255, 255, 255);
|
shape4->strokeFill(255, 255, 255);
|
||||||
scene->push(std::move(shape4));
|
scene->push(std::move(shape4));
|
||||||
|
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendCircle(550, 550, 150, 150);
|
shape5->appendCircle(550, 550, 150, 150);
|
||||||
shape5->fill(255, 0, 255);
|
shape5->fill(255, 0, 255);
|
||||||
shape5->stroke(5);
|
shape5->strokeWidth(5);
|
||||||
shape5->stroke(255, 255, 255);
|
shape5->strokeFill(255, 255, 255);
|
||||||
scene->push(std::move(shape5));
|
scene->push(std::move(shape5));
|
||||||
|
|
||||||
if (canvas->push(std::move(scene)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(scene)) != tvg::Result::Success) return;
|
||||||
|
|
|
@ -50,8 +50,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendRect(450, 100, 200, 200, 50, 50);
|
shape2->appendRect(450, 100, 200, 200, 50, 50);
|
||||||
shape2->fill(0, 255, 0);
|
shape2->fill(0, 255, 0);
|
||||||
shape2->stroke(10);
|
shape2->strokeWidth(10);
|
||||||
shape2->stroke(255, 255, 255);
|
shape2->strokeFill(255, 255, 255);
|
||||||
scene->push(std::move(shape2));
|
scene->push(std::move(shape2));
|
||||||
|
|
||||||
//Draw the Scene onto the Canvas
|
//Draw the Scene onto the Canvas
|
||||||
|
@ -79,8 +79,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->lineTo(146, 143);
|
shape3->lineTo(146, 143);
|
||||||
shape3->close();
|
shape3->close();
|
||||||
shape3->fill(0, 0, 255);
|
shape3->fill(0, 0, 255);
|
||||||
shape3->stroke(10);
|
shape3->strokeWidth(10);
|
||||||
shape3->stroke(255, 255, 255);
|
shape3->strokeFill(255, 255, 255);
|
||||||
shape3->opacity(127);
|
shape3->opacity(127);
|
||||||
|
|
||||||
scene2->push(std::move(shape3));
|
scene2->push(std::move(shape3));
|
||||||
|
@ -101,8 +101,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape4->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
shape4->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
|
||||||
shape4->close();
|
shape4->close();
|
||||||
shape4->fill(255, 0, 0);
|
shape4->fill(255, 0, 0);
|
||||||
shape4->stroke(10);
|
shape4->strokeWidth(10);
|
||||||
shape4->stroke(0, 0, 255);
|
shape4->strokeFill(0, 0, 255);
|
||||||
shape4->opacity(200);
|
shape4->opacity(200);
|
||||||
shape4->scale(3);
|
shape4->scale(3);
|
||||||
scene2->push(std::move(shape4));
|
scene2->push(std::move(shape4));
|
||||||
|
|
|
@ -68,8 +68,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
//Source
|
//Source
|
||||||
auto shape = tvg::Shape::gen();
|
auto shape = tvg::Shape::gen();
|
||||||
shape->appendRect(100, 100, 400, 400, 50, 50);
|
shape->appendRect(100, 100, 400, 400, 50, 50);
|
||||||
shape->stroke(0, 0, 255);
|
shape->strokeFill(0, 0, 255);
|
||||||
shape->stroke(10);
|
shape->strokeWidth(10);
|
||||||
shape->fill(255, 255, 255);
|
shape->fill(255, 255, 255);
|
||||||
shape->composite(std::move(clipper), tvg::CompositeMethod::ClipPath);
|
shape->composite(std::move(clipper), tvg::CompositeMethod::ClipPath);
|
||||||
if (canvas->push(std::move(shape)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape)) != tvg::Result::Success) return;
|
||||||
|
|
|
@ -39,8 +39,8 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendRect(-235, -250, 400, 400, 50, 50); //x, y, w, h, rx, ry
|
shape1->appendRect(-235, -250, 400, 400, 50, 50); //x, y, w, h, rx, ry
|
||||||
shape1->fill(0, 255, 0); //r, g, b
|
shape1->fill(0, 255, 0); //r, g, b
|
||||||
shape1->stroke(5); //width
|
shape1->strokeWidth(5); //width
|
||||||
shape1->stroke(255, 255, 255); //r, g, b
|
shape1->strokeFill(255, 255, 255); //r, g, b
|
||||||
scene->push(std::move(shape1));
|
scene->push(std::move(shape1));
|
||||||
|
|
||||||
//Prepare Circle (Scene1)
|
//Prepare Circle (Scene1)
|
||||||
|
@ -78,8 +78,8 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||||
shape4->lineTo(-53, -5.5);
|
shape4->lineTo(-53, -5.5);
|
||||||
shape4->close();
|
shape4->close();
|
||||||
shape4->fill(0, 0, 255, 127);
|
shape4->fill(0, 0, 255, 127);
|
||||||
shape4->stroke(3); //width
|
shape4->strokeWidth(3); //width
|
||||||
shape4->stroke(0, 0, 255); //r, g, b
|
shape4->strokeFill(0, 0, 255); //r, g, b
|
||||||
scene2->push(std::move(shape4));
|
scene2->push(std::move(shape4));
|
||||||
|
|
||||||
//Circle (Scene2)
|
//Circle (Scene2)
|
||||||
|
|
|
@ -34,9 +34,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape1 = tvg::Shape::gen();
|
auto shape1 = tvg::Shape::gen();
|
||||||
shape1->appendRect(50, 50, 200, 200);
|
shape1->appendRect(50, 50, 200, 200);
|
||||||
shape1->fill(50, 50, 50);
|
shape1->fill(50, 50, 50);
|
||||||
shape1->stroke(255, 255, 255); //color: r, g, b
|
shape1->strokeFill(255, 255, 255); //color: r, g, b
|
||||||
shape1->stroke(tvg::StrokeJoin::Bevel); //default is Bevel
|
shape1->strokeJoin(tvg::StrokeJoin::Bevel); //default is Bevel
|
||||||
shape1->stroke(10); //width: 10px
|
shape1->strokeWidth(10); //width: 10px
|
||||||
|
|
||||||
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
shape2->appendRect(300, 50, 200, 200);
|
shape2->appendRect(300, 50, 200, 200);
|
||||||
shape2->fill(50, 50, 50);
|
shape2->fill(50, 50, 50);
|
||||||
shape2->stroke(255, 255, 255);
|
shape2->strokeFill(255, 255, 255);
|
||||||
shape2->stroke(tvg::StrokeJoin::Round);
|
shape2->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
shape2->stroke(10);
|
shape2->strokeWidth(10);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
shape3->appendRect(550, 50, 200, 200);
|
shape3->appendRect(550, 50, 200, 200);
|
||||||
shape3->fill(50, 50, 50);
|
shape3->fill(50, 50, 50);
|
||||||
shape3->stroke(255, 255, 255);
|
shape3->strokeFill(255, 255, 255);
|
||||||
shape3->stroke(tvg::StrokeJoin::Miter);
|
shape3->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape3->stroke(10);
|
shape3->strokeWidth(10);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape4 = tvg::Shape::gen();
|
auto shape4 = tvg::Shape::gen();
|
||||||
shape4->appendCircle(150, 400, 100, 100);
|
shape4->appendCircle(150, 400, 100, 100);
|
||||||
shape4->fill(50, 50, 50);
|
shape4->fill(50, 50, 50);
|
||||||
shape4->stroke(255, 255, 255);
|
shape4->strokeFill(255, 255, 255);
|
||||||
shape4->stroke(1);
|
shape4->strokeWidth(1);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
shape5->appendCircle(400, 400, 100, 100);
|
shape5->appendCircle(400, 400, 100, 100);
|
||||||
shape5->fill(50, 50, 50);
|
shape5->fill(50, 50, 50);
|
||||||
shape5->stroke(255, 255, 255);
|
shape5->strokeFill(255, 255, 255);
|
||||||
shape5->stroke(2);
|
shape5->strokeWidth(2);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto shape6 = tvg::Shape::gen();
|
auto shape6 = tvg::Shape::gen();
|
||||||
shape6->appendCircle(650, 400, 100, 100);
|
shape6->appendCircle(650, 400, 100, 100);
|
||||||
shape6->fill(50, 50, 50);
|
shape6->fill(50, 50, 50);
|
||||||
shape6->stroke(255, 255, 255);
|
shape6->strokeFill(255, 255, 255);
|
||||||
shape6->stroke(4);
|
shape6->strokeWidth(4);
|
||||||
|
|
||||||
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -92,17 +92,17 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto hline = tvg::Shape::gen();
|
auto hline = tvg::Shape::gen();
|
||||||
hline->moveTo(50, 550 + (25 * i));
|
hline->moveTo(50, 550 + (25 * i));
|
||||||
hline->lineTo(300, 550 + (25 * i));
|
hline->lineTo(300, 550 + (25 * i));
|
||||||
hline->stroke(255, 255, 255); //color: r, g, b
|
hline->strokeFill(255, 255, 255); //color: r, g, b
|
||||||
hline->stroke(i + 1); //stroke width
|
hline->strokeWidth(i + 1); //stroke width
|
||||||
hline->stroke(tvg::StrokeCap::Round); //default is Square
|
hline->strokeCap(tvg::StrokeCap::Round); //default is Square
|
||||||
if (canvas->push(std::move(hline)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(hline)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto vline = tvg::Shape::gen();
|
auto vline = tvg::Shape::gen();
|
||||||
vline->moveTo(500 + (25 * i), 550);
|
vline->moveTo(500 + (25 * i), 550);
|
||||||
vline->lineTo(500 + (25 * i), 780);
|
vline->lineTo(500 + (25 * i), 780);
|
||||||
vline->stroke(255, 255, 255); //color: r, g, b
|
vline->strokeFill(255, 255, 255); //color: r, g, b
|
||||||
vline->stroke(i + 1); //stroke width
|
vline->strokeWidth(i + 1); //stroke width
|
||||||
vline->stroke(tvg::StrokeCap::Round); //default is Square
|
vline->strokeCap(tvg::StrokeCap::Round); //default is Square
|
||||||
if (canvas->push(std::move(vline)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(vline)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,19 +110,19 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
auto line1 = tvg::Shape::gen();
|
auto line1 = tvg::Shape::gen();
|
||||||
line1->moveTo(360, 580);
|
line1->moveTo(360, 580);
|
||||||
line1->lineTo(450, 580);
|
line1->lineTo(450, 580);
|
||||||
line1->stroke(255, 255, 255); //color: r, g, b
|
line1->strokeFill(255, 255, 255); //color: r, g, b
|
||||||
line1->stroke(15);
|
line1->strokeWidth(15);
|
||||||
line1->stroke(tvg::StrokeCap::Round);
|
line1->strokeCap(tvg::StrokeCap::Round);
|
||||||
|
|
||||||
auto line2 = tvg::cast<tvg::Shape>(line1->duplicate());
|
auto line2 = tvg::cast<tvg::Shape>(line1->duplicate());
|
||||||
auto line3 = tvg::cast<tvg::Shape>(line1->duplicate());
|
auto line3 = tvg::cast<tvg::Shape>(line1->duplicate());
|
||||||
if (canvas->push(std::move(line1)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(line1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
line2->stroke(tvg::StrokeCap::Square);
|
line2->strokeCap(tvg::StrokeCap::Square);
|
||||||
line2->translate(0, 50);
|
line2->translate(0, 50);
|
||||||
if (canvas->push(std::move(line2)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(line2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
line3->stroke(tvg::StrokeCap::Butt);
|
line3->strokeCap(tvg::StrokeCap::Butt);
|
||||||
line3->translate(0, 100);
|
line3->translate(0, 100);
|
||||||
if (canvas->push(std::move(line3)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(line3)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape1->lineTo(220, 200);
|
shape1->lineTo(220, 200);
|
||||||
shape1->lineTo( 70, 170);
|
shape1->lineTo( 70, 170);
|
||||||
shape1->lineTo( 70, 30);
|
shape1->lineTo( 70, 30);
|
||||||
shape1->stroke(255, 0, 0);
|
shape1->strokeFill(255, 0, 0);
|
||||||
shape1->stroke(10);
|
shape1->strokeWidth(10);
|
||||||
shape1->stroke(tvg::StrokeJoin::Round);
|
shape1->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
shape1->stroke(tvg::StrokeCap::Round);
|
shape1->strokeCap(tvg::StrokeCap::Round);
|
||||||
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
|
@ -49,10 +49,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape2->lineTo(470, 200);
|
shape2->lineTo(470, 200);
|
||||||
shape2->lineTo(320, 170);
|
shape2->lineTo(320, 170);
|
||||||
shape2->lineTo(320, 30);
|
shape2->lineTo(320, 30);
|
||||||
shape2->stroke(255, 255, 0);
|
shape2->strokeFill(255, 255, 0);
|
||||||
shape2->stroke(10);
|
shape2->strokeWidth(10);
|
||||||
shape2->stroke(tvg::StrokeJoin::Bevel);
|
shape2->strokeJoin(tvg::StrokeJoin::Bevel);
|
||||||
shape2->stroke(tvg::StrokeCap::Square);
|
shape2->strokeCap(tvg::StrokeCap::Square);
|
||||||
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -61,10 +61,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape3->lineTo(720, 200);
|
shape3->lineTo(720, 200);
|
||||||
shape3->lineTo(570, 170);
|
shape3->lineTo(570, 170);
|
||||||
shape3->lineTo(570, 30);
|
shape3->lineTo(570, 30);
|
||||||
shape3->stroke(0, 255, 0);
|
shape3->strokeFill(0, 255, 0);
|
||||||
shape3->stroke(10);
|
shape3->strokeWidth(10);
|
||||||
shape3->stroke(tvg::StrokeJoin::Miter);
|
shape3->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape3->stroke(tvg::StrokeCap::Butt);
|
shape3->strokeCap(tvg::StrokeCap::Butt);
|
||||||
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Test for Stroke Dash
|
//Test for Stroke Dash
|
||||||
|
@ -74,13 +74,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape4->lineTo(220, 380);
|
shape4->lineTo(220, 380);
|
||||||
shape4->lineTo( 70, 330);
|
shape4->lineTo( 70, 330);
|
||||||
shape4->lineTo( 70, 210);
|
shape4->lineTo( 70, 210);
|
||||||
shape4->stroke(255, 0, 0);
|
shape4->strokeFill(255, 0, 0);
|
||||||
shape4->stroke(5);
|
shape4->strokeWidth(5);
|
||||||
shape4->stroke(tvg::StrokeJoin::Round);
|
shape4->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
shape4->stroke(tvg::StrokeCap::Round);
|
shape4->strokeCap(tvg::StrokeCap::Round);
|
||||||
|
|
||||||
float dashPattern1[2] = {20, 10};
|
float dashPattern1[2] = {20, 10};
|
||||||
shape4->stroke(dashPattern1, 2);
|
shape4->strokeDash(dashPattern1, 2);
|
||||||
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape5 = tvg::Shape::gen();
|
auto shape5 = tvg::Shape::gen();
|
||||||
|
@ -89,13 +89,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape5->lineTo(470, 380);
|
shape5->lineTo(470, 380);
|
||||||
shape5->lineTo(320, 330);
|
shape5->lineTo(320, 330);
|
||||||
shape5->lineTo(320, 210);
|
shape5->lineTo(320, 210);
|
||||||
shape5->stroke(255, 255, 0);
|
shape5->strokeFill(255, 255, 0);
|
||||||
shape5->stroke(5);
|
shape5->strokeWidth(5);
|
||||||
shape5->stroke(tvg::StrokeJoin::Bevel);
|
shape5->strokeJoin(tvg::StrokeJoin::Bevel);
|
||||||
shape5->stroke(tvg::StrokeCap::Square);
|
shape5->strokeCap(tvg::StrokeCap::Square);
|
||||||
|
|
||||||
float dashPattern2[2] = {10, 10};
|
float dashPattern2[2] = {10, 10};
|
||||||
shape5->stroke(dashPattern2, 2);
|
shape5->strokeDash(dashPattern2, 2);
|
||||||
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape6 = tvg::Shape::gen();
|
auto shape6 = tvg::Shape::gen();
|
||||||
|
@ -104,38 +104,38 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape6->lineTo(720, 380);
|
shape6->lineTo(720, 380);
|
||||||
shape6->lineTo(570, 330);
|
shape6->lineTo(570, 330);
|
||||||
shape6->lineTo(570, 210);
|
shape6->lineTo(570, 210);
|
||||||
shape6->stroke(0, 255, 0);
|
shape6->strokeFill(0, 255, 0);
|
||||||
shape6->stroke(5);
|
shape6->strokeWidth(5);
|
||||||
shape6->stroke(tvg::StrokeJoin::Miter);
|
shape6->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape6->stroke(tvg::StrokeCap::Butt);
|
shape6->strokeCap(tvg::StrokeCap::Butt);
|
||||||
|
|
||||||
float dashPattern3[6] = {10, 10, 1, 8, 1, 10};
|
float dashPattern3[6] = {10, 10, 1, 8, 1, 10};
|
||||||
shape6->stroke(dashPattern3, 6);
|
shape6->strokeDash(dashPattern3, 6);
|
||||||
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//For a comparison with shapes 10-12
|
//For a comparison with shapes 10-12
|
||||||
auto shape7 = tvg::Shape::gen();
|
auto shape7 = tvg::Shape::gen();
|
||||||
shape7->appendArc(70, 400, 160, 10, 70, true);
|
shape7->appendArc(70, 400, 160, 10, 70, true);
|
||||||
shape7->stroke(255, 0, 0);
|
shape7->strokeFill(255, 0, 0);
|
||||||
shape7->stroke(7);
|
shape7->strokeWidth(7);
|
||||||
shape7->stroke(tvg::StrokeJoin::Round);
|
shape7->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
shape7->stroke(tvg::StrokeCap::Round);
|
shape7->strokeCap(tvg::StrokeCap::Round);
|
||||||
if (canvas->push(std::move(shape7)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape7)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape8 = tvg::Shape::gen();
|
auto shape8 = tvg::Shape::gen();
|
||||||
shape8->appendArc(320, 400, 160, 10, 70, false);
|
shape8->appendArc(320, 400, 160, 10, 70, false);
|
||||||
shape8->stroke(255, 255, 0);
|
shape8->strokeFill(255, 255, 0);
|
||||||
shape8->stroke(7);
|
shape8->strokeWidth(7);
|
||||||
shape8->stroke(tvg::StrokeJoin::Bevel);
|
shape8->strokeJoin(tvg::StrokeJoin::Bevel);
|
||||||
shape8->stroke(tvg::StrokeCap::Square);
|
shape8->strokeCap(tvg::StrokeCap::Square);
|
||||||
if (canvas->push(std::move(shape8)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape8)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape9 = tvg::Shape::gen();
|
auto shape9 = tvg::Shape::gen();
|
||||||
shape9->appendArc(570, 400, 160, 10, 70, true);
|
shape9->appendArc(570, 400, 160, 10, 70, true);
|
||||||
shape9->stroke(0, 255, 0);
|
shape9->strokeFill(0, 255, 0);
|
||||||
shape9->stroke(7);
|
shape9->strokeWidth(7);
|
||||||
shape9->stroke(tvg::StrokeJoin::Miter);
|
shape9->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape9->stroke(tvg::StrokeCap::Butt);
|
shape9->strokeCap(tvg::StrokeCap::Butt);
|
||||||
if (canvas->push(std::move(shape9)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape9)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
//Test for Stroke Dash for Arc, Circle, Rect
|
//Test for Stroke Dash for Arc, Circle, Rect
|
||||||
|
@ -143,33 +143,33 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
shape10->appendArc(70, 600, 160, 10, 30, true);
|
shape10->appendArc(70, 600, 160, 10, 30, true);
|
||||||
shape10->appendCircle(70, 700, 20, 60);
|
shape10->appendCircle(70, 700, 20, 60);
|
||||||
shape10->appendRect(130, 710, 100, 40);
|
shape10->appendRect(130, 710, 100, 40);
|
||||||
shape10->stroke(255, 0, 0);
|
shape10->strokeFill(255, 0, 0);
|
||||||
shape10->stroke(5);
|
shape10->strokeWidth(5);
|
||||||
shape10->stroke(tvg::StrokeJoin::Round);
|
shape10->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
shape10->stroke(tvg::StrokeCap::Round);
|
shape10->strokeCap(tvg::StrokeCap::Round);
|
||||||
shape10->stroke(dashPattern1, 2);
|
shape10->strokeDash(dashPattern1, 2);
|
||||||
if (canvas->push(std::move(shape10)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape10)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape11 = tvg::Shape::gen();
|
auto shape11 = tvg::Shape::gen();
|
||||||
shape11->appendArc(320, 600, 160, 10, 30, false);
|
shape11->appendArc(320, 600, 160, 10, 30, false);
|
||||||
shape11->appendCircle(320, 700, 20, 60);
|
shape11->appendCircle(320, 700, 20, 60);
|
||||||
shape11->appendRect(380, 710, 100, 40);
|
shape11->appendRect(380, 710, 100, 40);
|
||||||
shape11->stroke(255, 255, 0);
|
shape11->strokeFill(255, 255, 0);
|
||||||
shape11->stroke(5);
|
shape11->strokeWidth(5);
|
||||||
shape11->stroke(tvg::StrokeJoin::Bevel);
|
shape11->strokeJoin(tvg::StrokeJoin::Bevel);
|
||||||
shape11->stroke(tvg::StrokeCap::Square);
|
shape11->strokeCap(tvg::StrokeCap::Square);
|
||||||
shape11->stroke(dashPattern2, 2);
|
shape11->strokeDash(dashPattern2, 2);
|
||||||
if (canvas->push(std::move(shape11)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape11)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
auto shape12 = tvg::Shape::gen();
|
auto shape12 = tvg::Shape::gen();
|
||||||
shape12->appendArc(570, 600, 160, 10, 30, true);
|
shape12->appendArc(570, 600, 160, 10, 30, true);
|
||||||
shape12->appendCircle(570, 700, 20, 60);
|
shape12->appendCircle(570, 700, 20, 60);
|
||||||
shape12->appendRect(630, 710, 100, 40);
|
shape12->appendRect(630, 710, 100, 40);
|
||||||
shape12->stroke(0, 255, 0);
|
shape12->strokeFill(0, 255, 0);
|
||||||
shape12->stroke(5);
|
shape12->strokeWidth(5);
|
||||||
shape12->stroke(tvg::StrokeJoin::Miter);
|
shape12->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
shape12->stroke(tvg::StrokeCap::Butt);
|
shape12->strokeCap(tvg::StrokeCap::Butt);
|
||||||
shape12->stroke(dashPattern3, 6);
|
shape12->strokeDash(dashPattern3, 6);
|
||||||
if (canvas->push(std::move(shape12)) != tvg::Result::Success) return;
|
if (canvas->push(std::move(shape12)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,12 @@ void goWild(tvg::Canvas* canvas)
|
||||||
path->close();
|
path->close();
|
||||||
|
|
||||||
path->fill(150, 150, 255); // fill color
|
path->fill(150, 150, 255); // fill color
|
||||||
path->stroke(20); // stroke width
|
path->strokeWidth(20); // stroke width
|
||||||
path->stroke(120, 120, 255); // stroke color
|
path->strokeFill(120, 120, 255); // stroke color
|
||||||
|
|
||||||
// path->stroke(tvg::StrokeJoin::Round);
|
// path->strokeJoin(tvg::StrokeJoin::Round);
|
||||||
// path->stroke(tvg::StrokeJoin::Bevel);
|
// path->strokeJoin(tvg::StrokeJoin::Bevel);
|
||||||
path->stroke(tvg::StrokeJoin::Miter);
|
path->strokeJoin(tvg::StrokeJoin::Miter);
|
||||||
|
|
||||||
path->strokeMiterlimit(10);
|
path->strokeMiterlimit(10);
|
||||||
static float ml = path->strokeMiterlimit();
|
static float ml = path->strokeMiterlimit();
|
||||||
|
|
|
@ -157,9 +157,9 @@ unique_ptr<tvg::Paint> tvgGradientShape(tvg::Fill::ColorStop* colorStops, int co
|
||||||
auto shape = tvg::Shape::gen();
|
auto shape = tvg::Shape::gen();
|
||||||
shape->appendCircle(200, 200, 180, 80);
|
shape->appendCircle(200, 200, 180, 80);
|
||||||
shape->fill(std::move(fillShape));
|
shape->fill(std::move(fillShape));
|
||||||
shape->stroke(20);
|
shape->strokeWidth(20);
|
||||||
shape->stroke(dashPattern, 2);
|
shape->strokeDash(dashPattern, 2);
|
||||||
shape->stroke(std::move(fillStroke));
|
shape->strokeFill(std::move(fillStroke));
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ static void _updateTransform(TVG_UNUSED LottieGroup* parent, LottieObject** chil
|
||||||
|
|
||||||
//FIXME: preserve the stroke width. too workaround, need a better design.
|
//FIXME: preserve the stroke width. too workaround, need a better design.
|
||||||
if (P(ctx.propagator)->rs.strokeWidth() > 0.0f) {
|
if (P(ctx.propagator)->rs.strokeWidth() > 0.0f) {
|
||||||
ctx.propagator->stroke(P(ctx.propagator)->rs.strokeWidth() / sqrt(matrix.e11 * matrix.e11 + matrix.e12 * matrix.e12));
|
ctx.propagator->strokeWidth(P(ctx.propagator)->rs.strokeWidth() / sqrt(matrix.e11 * matrix.e11 + matrix.e12 * matrix.e12));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,9 +217,9 @@ static void _updateGroup(LottieGroup* parent, LottieObject** child, float frameN
|
||||||
|
|
||||||
static void _updateStroke(LottieStroke* stroke, float frameNo, RenderContext& ctx)
|
static void _updateStroke(LottieStroke* stroke, float frameNo, RenderContext& ctx)
|
||||||
{
|
{
|
||||||
ctx.propagator->stroke(stroke->width(frameNo));
|
ctx.propagator->strokeWidth(stroke->width(frameNo));
|
||||||
ctx.propagator->stroke(stroke->cap);
|
ctx.propagator->strokeCap(stroke->cap);
|
||||||
ctx.propagator->stroke(stroke->join);
|
ctx.propagator->strokeJoin(stroke->join);
|
||||||
ctx.propagator->strokeMiterlimit(stroke->miterLimit);
|
ctx.propagator->strokeMiterlimit(stroke->miterLimit);
|
||||||
|
|
||||||
if (stroke->dashattr) {
|
if (stroke->dashattr) {
|
||||||
|
@ -228,7 +228,7 @@ static void _updateStroke(LottieStroke* stroke, float frameNo, RenderContext& ct
|
||||||
dashes[1] = dashes[0] + stroke->dashGap(frameNo);
|
dashes[1] = dashes[0] + stroke->dashGap(frameNo);
|
||||||
P(ctx.propagator)->strokeDash(dashes, 2, stroke->dashOffset(frameNo));
|
P(ctx.propagator)->strokeDash(dashes, 2, stroke->dashOffset(frameNo));
|
||||||
} else {
|
} else {
|
||||||
ctx.propagator->stroke(nullptr, 0);
|
ctx.propagator->strokeDash(nullptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static bool _fragmentedStroking(LottieObject** child, queue<RenderContext>& cont
|
||||||
|
|
||||||
contexts.push(ctx);
|
contexts.push(ctx);
|
||||||
auto& fragment = contexts.back();
|
auto& fragment = contexts.back();
|
||||||
fragment.propagator->stroke(0.0f);
|
fragment.propagator->strokeWidth(0.0f);
|
||||||
fragment.begin = child - 1;
|
fragment.begin = child - 1;
|
||||||
ctx.stroking = true;
|
ctx.stroking = true;
|
||||||
|
|
||||||
|
@ -256,8 +256,7 @@ static void _updateSolidStroke(TVG_UNUSED LottieGroup* parent, LottieObject** ch
|
||||||
|
|
||||||
ctx.merging = nullptr;
|
ctx.merging = nullptr;
|
||||||
auto color = stroke->color(frameNo);
|
auto color = stroke->color(frameNo);
|
||||||
ctx.propagator->stroke(color.rgb[0], color.rgb[1], color.rgb[2], stroke->opacity(frameNo));
|
ctx.propagator->strokeFill(color.rgb[0], color.rgb[1], color.rgb[2], stroke->opacity(frameNo));
|
||||||
|
|
||||||
_updateStroke(static_cast<LottieStroke*>(stroke), frameNo, ctx);
|
_updateStroke(static_cast<LottieStroke*>(stroke), frameNo, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +268,7 @@ static void _updateGradientStroke(TVG_UNUSED LottieGroup* parent, LottieObject**
|
||||||
auto stroke = static_cast<LottieGradientStroke*>(*child);
|
auto stroke = static_cast<LottieGradientStroke*>(*child);
|
||||||
|
|
||||||
ctx.merging = nullptr;
|
ctx.merging = nullptr;
|
||||||
ctx.propagator->stroke(unique_ptr<Fill>(stroke->fill(frameNo)));
|
ctx.propagator->strokeFill(unique_ptr<Fill>(stroke->fill(frameNo)));
|
||||||
|
|
||||||
_updateStroke(static_cast<LottieStroke*>(stroke), frameNo, ctx);
|
_updateStroke(static_cast<LottieStroke*>(stroke), frameNo, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -347,9 +347,9 @@ static void _applyProperty(SvgLoaderData& loaderData, SvgNode* node, Shape* vg,
|
||||||
if (node->type == SvgNodeType::G || node->type == SvgNodeType::Use) return;
|
if (node->type == SvgNodeType::G || node->type == SvgNodeType::Use) return;
|
||||||
|
|
||||||
//Apply the stroke style property
|
//Apply the stroke style property
|
||||||
vg->stroke(style->stroke.width);
|
vg->strokeWidth(style->stroke.width);
|
||||||
vg->stroke(style->stroke.cap);
|
vg->strokeCap(style->stroke.cap);
|
||||||
vg->stroke(style->stroke.join);
|
vg->strokeJoin(style->stroke.join);
|
||||||
vg->strokeMiterlimit(style->stroke.miterlimit);
|
vg->strokeMiterlimit(style->stroke.miterlimit);
|
||||||
if (style->stroke.dash.array.count > 0) {
|
if (style->stroke.dash.array.count > 0) {
|
||||||
P(vg)->strokeDash(style->stroke.dash.array.data, style->stroke.dash.array.count, style->stroke.dash.offset);
|
P(vg)->strokeDash(style->stroke.dash.array.data, style->stroke.dash.array.count, style->stroke.dash.offset);
|
||||||
|
@ -357,26 +357,26 @@ static void _applyProperty(SvgLoaderData& loaderData, SvgNode* node, Shape* vg,
|
||||||
|
|
||||||
//If stroke property is nullptr then do nothing
|
//If stroke property is nullptr then do nothing
|
||||||
if (style->stroke.paint.none) {
|
if (style->stroke.paint.none) {
|
||||||
vg->stroke(0.0f);
|
vg->strokeWidth(0.0f);
|
||||||
} else if (style->stroke.paint.gradient) {
|
} else if (style->stroke.paint.gradient) {
|
||||||
Box bBox = vBox;
|
Box bBox = vBox;
|
||||||
if (!style->stroke.paint.gradient->userSpace) bBox = _boundingBox(vg);
|
if (!style->stroke.paint.gradient->userSpace) bBox = _boundingBox(vg);
|
||||||
|
|
||||||
if (style->stroke.paint.gradient->type == SvgGradientType::Linear) {
|
if (style->stroke.paint.gradient->type == SvgGradientType::Linear) {
|
||||||
auto linear = _applyLinearGradientProperty(style->stroke.paint.gradient, vg, bBox, style->stroke.opacity);
|
auto linear = _applyLinearGradientProperty(style->stroke.paint.gradient, vg, bBox, style->stroke.opacity);
|
||||||
vg->stroke(std::move(linear));
|
vg->strokeFill(std::move(linear));
|
||||||
} else if (style->stroke.paint.gradient->type == SvgGradientType::Radial) {
|
} else if (style->stroke.paint.gradient->type == SvgGradientType::Radial) {
|
||||||
auto radial = _applyRadialGradientProperty(style->stroke.paint.gradient, vg, bBox, style->stroke.opacity);
|
auto radial = _applyRadialGradientProperty(style->stroke.paint.gradient, vg, bBox, style->stroke.opacity);
|
||||||
vg->stroke(std::move(radial));
|
vg->strokeFill(std::move(radial));
|
||||||
}
|
}
|
||||||
} else if (style->stroke.paint.url) {
|
} else if (style->stroke.paint.url) {
|
||||||
//TODO: Apply the color pointed by url
|
//TODO: Apply the color pointed by url
|
||||||
} else if (style->stroke.paint.curColor) {
|
} else if (style->stroke.paint.curColor) {
|
||||||
//Apply the current style color
|
//Apply the current style color
|
||||||
vg->stroke(style->color.r, style->color.g, style->color.b, style->stroke.opacity);
|
vg->strokeFill(style->color.r, style->color.g, style->color.b, style->stroke.opacity);
|
||||||
} else {
|
} else {
|
||||||
//Apply the stroke color
|
//Apply the stroke color
|
||||||
vg->stroke(style->stroke.paint.color.r, style->stroke.paint.color.g, style->stroke.paint.color.b, style->stroke.opacity);
|
vg->strokeFill(style->stroke.paint.color.r, style->stroke.paint.color.g, style->stroke.paint.color.b, style->stroke.opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyComposition(loaderData, vg, node, vBox, svgPath);
|
_applyComposition(loaderData, vg, node, vBox, svgPath);
|
||||||
|
@ -804,7 +804,7 @@ static unique_ptr<Scene> _sceneBuildHelper(SvgLoaderData& loaderData, const SvgN
|
||||||
uint8_t r, g, b;
|
uint8_t r, g, b;
|
||||||
shape->fillColor(&r, &g, &b);
|
shape->fillColor(&r, &g, &b);
|
||||||
if (shape->fill() || r < 255 || g < 255 || b < 255 || shape->strokeFill() ||
|
if (shape->fill() || r < 255 || g < 255 || b < 255 || shape->strokeFill() ||
|
||||||
(shape->strokeColor(&r, &g, &b) == Result::Success && (r < 255 || g < 255 || b < 255))) {
|
(shape->strokeFill(&r, &g, &b) == Result::Success && (r < 255 || g < 255 || b < 255))) {
|
||||||
*isMaskWhite = false;
|
*isMaskWhite = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ static bool _parseShapeStrokeDashPattern(const char *ptr, const char *end, Shape
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
shape->stroke(dashPattern, dashPatternCnt);
|
shape->strokeDash(dashPattern, dashPatternCnt);
|
||||||
free(dashPattern);
|
free(dashPattern);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -300,12 +300,12 @@ static bool _parseShapeStroke(const char *ptr, const char *end, Shape *shape)
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case TVG_TAG_SHAPE_STROKE_CAP: {
|
case TVG_TAG_SHAPE_STROKE_CAP: {
|
||||||
if (block.length != SIZE(TvgBinFlag)) return false;
|
if (block.length != SIZE(TvgBinFlag)) return false;
|
||||||
shape->stroke((StrokeCap) *block.data);
|
shape->strokeCap((StrokeCap) *block.data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TVG_TAG_SHAPE_STROKE_JOIN: {
|
case TVG_TAG_SHAPE_STROKE_JOIN: {
|
||||||
if (block.length != SIZE(TvgBinFlag)) return false;
|
if (block.length != SIZE(TvgBinFlag)) return false;
|
||||||
shape->stroke((StrokeJoin) *block.data);
|
shape->strokeJoin((StrokeJoin) *block.data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TVG_TAG_SHAPE_STROKE_ORDER: {
|
case TVG_TAG_SHAPE_STROKE_ORDER: {
|
||||||
|
@ -317,18 +317,18 @@ static bool _parseShapeStroke(const char *ptr, const char *end, Shape *shape)
|
||||||
if (block.length != SIZE(float)) return false;
|
if (block.length != SIZE(float)) return false;
|
||||||
float width;
|
float width;
|
||||||
READ_FLOAT(&width, block.data);
|
READ_FLOAT(&width, block.data);
|
||||||
shape->stroke(width);
|
shape->strokeWidth(width);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TVG_TAG_SHAPE_STROKE_COLOR: {
|
case TVG_TAG_SHAPE_STROKE_COLOR: {
|
||||||
if (block.length != 4) return false;
|
if (block.length != 4) return false;
|
||||||
shape->stroke(block.data[0], block.data[1], block.data[2], block.data[3]);
|
shape->strokeFill(block.data[0], block.data[1], block.data[2], block.data[3]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TVG_TAG_SHAPE_STROKE_FILL: {
|
case TVG_TAG_SHAPE_STROKE_FILL: {
|
||||||
auto fill = _parseShapeFill(block.data, block.end);
|
auto fill = _parseShapeFill(block.data, block.end);
|
||||||
if (!fill) return false;
|
if (!fill) return false;
|
||||||
shape->stroke(std::move(fill));
|
shape->strokeFill(std::move(fill));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TVG_TAG_SHAPE_STROKE_DASHPTRN: {
|
case TVG_TAG_SHAPE_STROKE_DASHPTRN: {
|
||||||
|
|
|
@ -271,7 +271,7 @@ bool GlRenderer::renderShape(RenderData data)
|
||||||
|
|
||||||
if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform))
|
if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform))
|
||||||
{
|
{
|
||||||
sdata->rshape->strokeColor(&r, &g, &b, &a);
|
sdata->rshape->strokeFill(&r, &g, &b, &a);
|
||||||
if (a > 0)
|
if (a > 0)
|
||||||
{
|
{
|
||||||
drawPrimitive(*sdata, r, g, b, a, RenderUpdateFlag::Stroke);
|
drawPrimitive(*sdata, r, g, b, a, RenderUpdateFlag::Stroke);
|
||||||
|
@ -372,7 +372,7 @@ RenderData GlRenderer::prepare(const RenderShape& rshape, RenderData data, const
|
||||||
//invisible?
|
//invisible?
|
||||||
uint8_t alphaF = 0, alphaS = 0;
|
uint8_t alphaF = 0, alphaS = 0;
|
||||||
rshape.fillColor(nullptr, nullptr, nullptr, &alphaF);
|
rshape.fillColor(nullptr, nullptr, nullptr, &alphaF);
|
||||||
rshape.strokeColor(nullptr, nullptr, nullptr, &alphaS);
|
rshape.strokeFill(nullptr, nullptr, nullptr, &alphaS);
|
||||||
|
|
||||||
if ( ((sdata->updateFlag & RenderUpdateFlag::Gradient) == 0) &&
|
if ( ((sdata->updateFlag & RenderUpdateFlag::Gradient) == 0) &&
|
||||||
((sdata->updateFlag & RenderUpdateFlag::Color) && alphaF == 0) &&
|
((sdata->updateFlag & RenderUpdateFlag::Color) && alphaF == 0) &&
|
||||||
|
|
|
@ -350,7 +350,7 @@ static void _renderStroke(SwShapeTask* task, SwSurface* surface, uint8_t opacity
|
||||||
if (auto strokeFill = task->rshape->strokeFill()) {
|
if (auto strokeFill = task->rshape->strokeFill()) {
|
||||||
rasterGradientStroke(surface, &task->shape, strokeFill->identifier());
|
rasterGradientStroke(surface, &task->shape, strokeFill->identifier());
|
||||||
} else {
|
} else {
|
||||||
if (task->rshape->strokeColor(&r, &g, &b, &a)) {
|
if (task->rshape->strokeFill(&r, &g, &b, &a)) {
|
||||||
a = MULTIPLY(opacity, a);
|
a = MULTIPLY(opacity, a);
|
||||||
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
|
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ struct RenderShape
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const
|
bool strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const
|
||||||
{
|
{
|
||||||
if (!stroke) return false;
|
if (!stroke) return false;
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ Result Shape::order(bool strokeFirst) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(float width) noexcept
|
Result Shape::strokeWidth(float width) noexcept
|
||||||
{
|
{
|
||||||
if (!pImpl->strokeWidth(width)) return Result::FailedAllocation;
|
if (!pImpl->strokeWidth(width)) return Result::FailedAllocation;
|
||||||
|
|
||||||
|
@ -307,23 +307,23 @@ float Shape::strokeWidth() const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept
|
Result Shape::strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept
|
||||||
{
|
{
|
||||||
if (!pImpl->strokeColor(r, g, b, a)) return Result::FailedAllocation;
|
if (!pImpl->strokeFill(r, g, b, a)) return Result::FailedAllocation;
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept
|
Result Shape::strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept
|
||||||
{
|
{
|
||||||
if (!pImpl->rs.strokeColor(r, g, b, a)) return Result::InsufficientCondition;
|
if (!pImpl->rs.strokeFill(r, g, b, a)) return Result::InsufficientCondition;
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(unique_ptr<Fill> f) noexcept
|
Result Shape::strokeFill(unique_ptr<Fill> f) noexcept
|
||||||
{
|
{
|
||||||
return pImpl->strokeFill(std::move(f));
|
return pImpl->strokeFill(std::move(f));
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ const Fill* Shape::strokeFill() const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(const float* dashPattern, uint32_t cnt) noexcept
|
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt) noexcept
|
||||||
{
|
{
|
||||||
return pImpl->strokeDash(dashPattern, cnt, 0);
|
return pImpl->strokeDash(dashPattern, cnt, 0);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ uint32_t Shape::strokeDash(const float** dashPattern) const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(StrokeCap cap) noexcept
|
Result Shape::strokeCap(StrokeCap cap) noexcept
|
||||||
{
|
{
|
||||||
if (!pImpl->strokeCap(cap)) return Result::FailedAllocation;
|
if (!pImpl->strokeCap(cap)) return Result::FailedAllocation;
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ Result Shape::stroke(StrokeCap cap) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result Shape::stroke(StrokeJoin join) noexcept
|
Result Shape::strokeJoin(StrokeJoin join) noexcept
|
||||||
{
|
{
|
||||||
if (!pImpl->strokeJoin(join)) return Result::FailedAllocation;
|
if (!pImpl->strokeJoin(join)) return Result::FailedAllocation;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ struct Shape::Impl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool strokeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
bool strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||||
{
|
{
|
||||||
if (!rs.stroke) rs.stroke = new RenderStroke();
|
if (!rs.stroke) rs.stroke = new RenderStroke();
|
||||||
if (rs.stroke->fill) {
|
if (rs.stroke->fill) {
|
||||||
|
|
|
@ -100,8 +100,8 @@ static bool _merge(Shape* from, Shape* to)
|
||||||
|
|
||||||
r = g = b = a = r2 = g2 = b2 = a2 = 0;
|
r = g = b = a = r2 = g2 = b2 = a2 = 0;
|
||||||
|
|
||||||
from->strokeColor(&r, &g, &b, &a);
|
from->strokeFill(&r, &g, &b, &a);
|
||||||
to->strokeColor(&r2, &g2, &b2, &a2);
|
to->strokeFill(&r2, &g2, &b2, &a2);
|
||||||
|
|
||||||
if (r != r2 || g != g2 || b != b2 || a != a2) return false;
|
if (r != r2 || g != g2 || b != b2 || a != a2) return false;
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ TvgBinCounter TvgSaver::serializeStroke(const Shape* shape, const Matrix* pTrans
|
||||||
cnt += serializeFill(fill, TVG_TAG_SHAPE_STROKE_FILL, (preTransform ? pTransform : nullptr));
|
cnt += serializeFill(fill, TVG_TAG_SHAPE_STROKE_FILL, (preTransform ? pTransform : nullptr));
|
||||||
} else {
|
} else {
|
||||||
uint8_t color[4] = {0, 0, 0, 0};
|
uint8_t color[4] = {0, 0, 0, 0};
|
||||||
shape->strokeColor(color, color + 1, color + 2, color + 3);
|
shape->strokeFill(color, color + 1, color + 2, color + 3);
|
||||||
cnt += writeTagProperty(TVG_TAG_SHAPE_STROKE_COLOR, SIZE(color), &color);
|
cnt += writeTagProperty(TVG_TAG_SHAPE_STROKE_COLOR, SIZE(color), &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ TvgBinCounter TvgSaver::serializeShape(const Shape* shape, const Matrix* pTransf
|
||||||
//stroke
|
//stroke
|
||||||
if (shape->strokeWidth() > 0) {
|
if (shape->strokeWidth() > 0) {
|
||||||
uint8_t color[4] = {0, 0, 0, 0};
|
uint8_t color[4] = {0, 0, 0, 0};
|
||||||
shape->strokeColor(color, color + 1, color + 2, color + 3);
|
shape->strokeFill(color, color + 1, color + 2, color + 3);
|
||||||
auto fill = shape->strokeFill();
|
auto fill = shape->strokeFill();
|
||||||
if (fill || color[3] > 0) {
|
if (fill || color[3] > 0) {
|
||||||
if (!mathEqual(cTransform->e11, cTransform->e22) || (mathZero(cTransform->e11) && !mathEqual(cTransform->e12, cTransform->e21)) || shape->strokeDash(nullptr) > 0) preTransform = false;
|
if (!mathEqual(cTransform->e11, cTransform->e22) || (mathZero(cTransform->e11) && !mathEqual(cTransform->e12, cTransform->e21)) || shape->strokeDash(nullptr) > 0) preTransform = false;
|
||||||
|
|
|
@ -146,29 +146,29 @@ TEST_CASE("Stroking", "[tvgShape]")
|
||||||
REQUIRE(shape->order(false) == Result::Success);
|
REQUIRE(shape->order(false) == Result::Success);
|
||||||
|
|
||||||
//Stroke Width
|
//Stroke Width
|
||||||
REQUIRE(shape->stroke(0) == Result::Success);
|
REQUIRE(shape->strokeWidth(0) == Result::Success);
|
||||||
REQUIRE(shape->strokeWidth() == 0);
|
REQUIRE(shape->strokeWidth() == 0);
|
||||||
REQUIRE(shape->stroke(300) == Result::Success);
|
REQUIRE(shape->strokeWidth(300) == Result::Success);
|
||||||
REQUIRE(shape->strokeWidth() == 300);
|
REQUIRE(shape->strokeWidth() == 300);
|
||||||
|
|
||||||
//Stroke Color
|
//Stroke Color
|
||||||
uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
REQUIRE(shape->stroke(0, 50, 100, 200) == Result::Success);
|
REQUIRE(shape->strokeFill(0, 50, 100, 200) == Result::Success);
|
||||||
REQUIRE(shape->strokeColor(nullptr, nullptr, &b, nullptr) == Result::Success);
|
REQUIRE(shape->strokeFill(nullptr, nullptr, &b, nullptr) == Result::Success);
|
||||||
REQUIRE(b == 100);
|
REQUIRE(b == 100);
|
||||||
REQUIRE(shape->strokeColor(&r, &g, &b, &a) == Result::Success);
|
REQUIRE(shape->strokeFill(&r, &g, &b, &a) == Result::Success);
|
||||||
REQUIRE(r == 0);
|
REQUIRE(r == 0);
|
||||||
REQUIRE(g == 50);
|
REQUIRE(g == 50);
|
||||||
REQUIRE(b == 100);
|
REQUIRE(b == 100);
|
||||||
REQUIRE(a == 200);
|
REQUIRE(a == 200);
|
||||||
REQUIRE(shape->strokeColor(nullptr, nullptr, nullptr, nullptr) == Result::Success);
|
REQUIRE(shape->strokeFill(nullptr, nullptr, nullptr, nullptr) == Result::Success);
|
||||||
|
|
||||||
//Stroke Dash
|
//Stroke Dash
|
||||||
float dashPattern[3] = {0, 1.5f, 2.22f};
|
float dashPattern[3] = {0, 1.5f, 2.22f};
|
||||||
REQUIRE(shape->stroke(dashPattern, 3) == Result::InvalidArguments);
|
REQUIRE(shape->strokeDash(dashPattern, 3) == Result::InvalidArguments);
|
||||||
|
|
||||||
float dashPattern2[3] = {1.0f, 1.5f, 2.22f};
|
float dashPattern2[3] = {1.0f, 1.5f, 2.22f};
|
||||||
REQUIRE(shape->stroke(dashPattern2, 3) == Result::Success);
|
REQUIRE(shape->strokeDash(dashPattern2, 3) == Result::Success);
|
||||||
|
|
||||||
const float* dashPattern3;
|
const float* dashPattern3;
|
||||||
REQUIRE(shape->strokeDash(nullptr) == 3);
|
REQUIRE(shape->strokeDash(nullptr) == 3);
|
||||||
|
@ -177,18 +177,18 @@ TEST_CASE("Stroking", "[tvgShape]")
|
||||||
REQUIRE(dashPattern3[1] == 1.5f);
|
REQUIRE(dashPattern3[1] == 1.5f);
|
||||||
REQUIRE(dashPattern3[2] == 2.22f);
|
REQUIRE(dashPattern3[2] == 2.22f);
|
||||||
|
|
||||||
REQUIRE(shape->stroke(nullptr, 0) == Result::Success);
|
REQUIRE(shape->strokeDash(nullptr, 0) == Result::Success);
|
||||||
|
|
||||||
//Stroke Cap
|
//Stroke Cap
|
||||||
REQUIRE(shape->strokeCap() == StrokeCap::Square);
|
REQUIRE(shape->strokeCap() == StrokeCap::Square);
|
||||||
REQUIRE(shape->stroke(StrokeCap::Round) == Result::Success);
|
REQUIRE(shape->strokeCap(StrokeCap::Round) == Result::Success);
|
||||||
REQUIRE(shape->stroke(StrokeCap::Butt) == Result::Success);
|
REQUIRE(shape->strokeCap(StrokeCap::Butt) == Result::Success);
|
||||||
REQUIRE(shape->strokeCap() == StrokeCap::Butt);
|
REQUIRE(shape->strokeCap() == StrokeCap::Butt);
|
||||||
|
|
||||||
//Stroke Join
|
//Stroke Join
|
||||||
REQUIRE(shape->strokeJoin() == StrokeJoin::Bevel);
|
REQUIRE(shape->strokeJoin() == StrokeJoin::Bevel);
|
||||||
REQUIRE(shape->stroke(StrokeJoin::Miter) == Result::Success);
|
REQUIRE(shape->strokeJoin(StrokeJoin::Miter) == Result::Success);
|
||||||
REQUIRE(shape->stroke(StrokeJoin::Round) == Result::Success);
|
REQUIRE(shape->strokeJoin(StrokeJoin::Round) == Result::Success);
|
||||||
REQUIRE(shape->strokeJoin() == StrokeJoin::Round);
|
REQUIRE(shape->strokeJoin() == StrokeJoin::Round);
|
||||||
|
|
||||||
//Stroke Miterlimit
|
//Stroke Miterlimit
|
||||||
|
|
|
@ -45,8 +45,8 @@ TEST_CASE("Basic draw", "[tvgSwEngine]")
|
||||||
REQUIRE(shape1);
|
REQUIRE(shape1);
|
||||||
|
|
||||||
REQUIRE(shape1->appendArc(150, 150, 80, 10, 180, false) == Result::Success);
|
REQUIRE(shape1->appendArc(150, 150, 80, 10, 180, false) == Result::Success);
|
||||||
REQUIRE(shape1->stroke(255, 255, 255, 255) == Result::Success);
|
REQUIRE(shape1->strokeFill(255, 255, 255, 255) == Result::Success);
|
||||||
REQUIRE(shape1->stroke(2) == Result::Success);
|
REQUIRE(shape1->strokeWidth(2) == Result::Success);
|
||||||
REQUIRE(canvas->push(std::move(shape1)) == Result::Success);
|
REQUIRE(canvas->push(std::move(shape1)) == Result::Success);
|
||||||
|
|
||||||
//Cubic
|
//Cubic
|
||||||
|
@ -56,7 +56,7 @@ TEST_CASE("Basic draw", "[tvgSwEngine]")
|
||||||
REQUIRE(shape2->moveTo(50, 25) == Result::Success);
|
REQUIRE(shape2->moveTo(50, 25) == Result::Success);
|
||||||
REQUIRE(shape2->cubicTo(62, 25, 75, 38, 75, 50) == Result::Success);
|
REQUIRE(shape2->cubicTo(62, 25, 75, 38, 75, 50) == Result::Success);
|
||||||
REQUIRE(shape2->close() == Result::Success);
|
REQUIRE(shape2->close() == Result::Success);
|
||||||
REQUIRE(shape2->stroke(1) == Result::Success);
|
REQUIRE(shape2->strokeWidth(1) == Result::Success);
|
||||||
REQUIRE(canvas->push(std::move(shape2)) == Result::Success);
|
REQUIRE(canvas->push(std::move(shape2)) == Result::Success);
|
||||||
|
|
||||||
//Line
|
//Line
|
||||||
|
@ -80,10 +80,10 @@ TEST_CASE("Basic draw", "[tvgSwEngine]")
|
||||||
REQUIRE(shape4->lineTo(25, 25) == Result::Success);
|
REQUIRE(shape4->lineTo(25, 25) == Result::Success);
|
||||||
REQUIRE(shape4->cubicTo(50, 50, 75, -75, 50, 100) == Result::Success);
|
REQUIRE(shape4->cubicTo(50, 50, 75, -75, 50, 100) == Result::Success);
|
||||||
REQUIRE(shape4->close() == Result::Success);
|
REQUIRE(shape4->close() == Result::Success);
|
||||||
REQUIRE(shape4->stroke(255, 0, 0, 255) == Result::Success);
|
REQUIRE(shape4->strokeFill(255, 0, 0, 255) == Result::Success);
|
||||||
REQUIRE(shape4->stroke(2) == Result::Success);
|
REQUIRE(shape4->strokeWidth(2) == Result::Success);
|
||||||
REQUIRE(shape4->stroke(dashPattern, 2) == Result::Success);
|
REQUIRE(shape4->strokeDash(dashPattern, 2) == Result::Success);
|
||||||
REQUIRE(shape4->stroke(StrokeCap::Round) == Result::Success);
|
REQUIRE(shape4->strokeCap(StrokeCap::Round) == Result::Success);
|
||||||
REQUIRE(canvas->push(std::move(shape4)) == Result::Success);
|
REQUIRE(canvas->push(std::move(shape4)) == Result::Success);
|
||||||
|
|
||||||
//Draw
|
//Draw
|
||||||
|
|
Loading…
Add table
Reference in a new issue