Mira Grudzinska
25a1321243
common: stroke dash offset support with new apis.
...
This change just allows users to use the offset of the stroke dash.
Actually feature enhacement has been introduced by
478e45f9f3
.
@APIs:
uint32_t Shape::strokeDash(const float** dashPattern) ->
uint32_t Shape::strokeDash(const float** dashPattern, float* offset = nullptr)
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt) ->
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f)
Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt) ->
Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt, float offset)
Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt) ->
Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt, float* offset)
@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-10-30 11:47:51 +09:00
Hermet Park
c77ef98fef
lottie/builder: enable layer blending
...
Issue: https://github.com/thorvg/thorvg/issues/1737
2023-10-27 12:13:00 +09:00
Hermet Park
db55481e97
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
2023-10-27 11:46:51 +09:00
Hermet Park
5a3bc31373
lottie: ++optimization with a caching effect.
...
reuse clippers if they are available.
Binary: +132
2023-10-26 15:24:36 +09:00
Hermet Park
d37c500262
lottie: introduced static layer cache.
...
lottie builder doesn't need to rebuild the layer object
if it has no any animation frame data.
That case, we can cache the layer scene in order to reuse it.
Tested on local machine (single thread):
- Lottie: appx. 2ms enhanced.
- Binary: +204
2023-10-26 15:24:36 +09:00
Hermet Park
21fbdfc904
lottie: clean up code
...
no logical changes, only code clean-up
2023-10-26 11:22:45 +09:00
Hermet Park
e570064eba
animation/lottie: updated the frame count unit.
...
replace the frame count unit from the int32_t to float
since animations could smoothly interpolate key-frames.
This notificably improve the animation smoothness in Lottie
Beta API changes:
Result Animation::frame(uint32_t no) -> Result Animation::frame(float no)
uint32_t Animation::curFrame() const -> float Animation::curFrame() const
uint32_t Animation::totalFrame() const -> float Animation::totalFrame() const
2023-10-24 11:49:57 +09:00
Hermet Park
a6d7a19047
api: enhance the API usage.
...
Allow users to omit the default type casting for added convenience.
2023-10-18 14:35:57 +09:00
Hermet Park
3123e184c8
lottie: Fixed trimpath to support simultaneous trimpath
...
The previous version omitted support for simultaneous trimpath,
but it is now working as intended.
2023-10-17 21:13:38 +09:00
Hermet Park
625c2405fc
lottie/builder: Fix overlapped stroking outlines.
...
Previously, the builder accumulated the outlines and fills
in one paint to reduce the rendering context.
However, this approach won't work for Lottie
if the resource contains multiple strokes with branched groups.
We should apply the optimization
only when the specified condition is satisfied.
2023-10-17 21:13:38 +09:00
Hermet Park
3a2de2bc6a
lottie/builder: fix a regression bug.
...
currently thorvg doesn't support full 3d transformation.
orthogonal projection is mandatory.
Issue: https://github.com/thorvg/thorvg/issues/1698
2023-10-13 14:26:59 +09:00
Hermet Park
eba7f2f0d7
lottie/builder: revise the render context for saving memory.
...
Allocate repeater context only when it's valid.
2023-10-09 11:00:33 +09:00
Hermet Park
57038df21f
Lottie: Fixed handling of multiple strokes in one layer.
...
Revised the rendering logic of Lottie by creating a new rendering context
using a queue when multiple strokes are requested.
Issue: https://github.com/thorvg/thorvg/issues/1642
2023-10-09 11:00:33 +09:00
Hermet Park
7ec969be29
lottie/builder: Fix incorrect stroke width scaling propagation.
...
The transform (scale) should be applied to the following drawing elements,
not the previous stroke.
2023-09-26 14:24:52 +09:00
Hermet Park
fdd90605c7
lottie/builder: fix a memory leak.
...
fixed a memory leak in an exceptional case.
2023-09-26 10:48:33 +09:00
Hermet Park
3b611e0da9
lottie: fixed data conversion complie warnings
2023-09-22 12:35:13 +09:00
Hermet Park
cba2b0f724
lottie/builder: correct a parenting error.
...
There is a missing case where a layer didn't parent properly,
especially when the parent is the matte target.
2023-09-21 22:11:31 +09:00
Hermet Park
5b8c66f5c8
lottie/builder: fix an invalid matting result.
...
Previously, it ignored the matte when it was out of frames for the sake of optimization.
However, this led to an incorrect matting result.
It should make the scene invisible when the matting is invisible.
2023-09-21 22:11:31 +09:00
Hermet Park
2cada9c446
loader/lottie: code refactoring.
...
migrate transform from the group to the layer.
transformation is not necessary in group but layer.
This helps to reduce the unnecessary assigning of the transformation
in group instances.
2023-09-19 14:03:13 +09:00
Hermet Park
549f4b1308
loader/lottie: properly handle graident opacity attributes.
...
That property has been missed in the implementation.
2023-09-19 10:33:22 +09:00
Hermet Park
8aa12ca468
taskschduler: fix a regression deadlock issue
...
This fix introduces a workaround to enforce synchronous tasking on worker threads.
Sometimes, out of threads get stuck in a deadlock condition.
@Issue: https://github.com/thorvg/thorvg/issues/1636
2023-09-18 21:06:01 +09:00
Hermet Park
81599a14a0
loader/lottie: code refactoring
...
moved clipping logic to the coherent precomp method.
2023-09-18 10:41:00 +09:00
Hermet Park
42d7a5faed
loader/lottie: correct the frame range.
...
Fixed some incorrect time-remapping logic,
Also, the last frame should not be taken into account for the drawing.
2023-09-18 10:41:00 +09:00
Hermet Park
87dee3c1f7
loader/lottie: fix a memory leak
...
A dangling scene instance should be deleted properly.
2023-09-18 10:41:00 +09:00
Hermet Park
00ab8c254d
loader/lottie: fix a missing opacity propagation.
...
the propagated opacity size should be accumulated.
2023-09-14 21:14:33 +09:00
Hermet Park
6b3bd8b27a
loader/lottie: fix a precomposition+matting.
...
the matting target with a precomp lost the referencing in
the building the structure. this fixes it.
2023-09-13 10:11:24 +09:00
Hermet Park
2998eb18fc
loader/lottie: fix an invalid memory access crash.
2023-09-12 20:56:38 +09:00
Hermet Park
3752ad93b3
loader/lottie: do not draw zero size content
...
skip rendering by setting opacity zero, if the scale factor is zero.
2023-09-12 20:55:16 +09:00
Hermet Park
e14e108d4a
loader/lotte: ++clean code
2023-09-08 15:01:28 +09:00
Hermet Park
516e8bf042
loader/lottie: minimum support for 3D transform
...
It lacks perspective projection information,
so it transforms 3D axes with orthogonal projection.
2023-09-07 17:59:52 +09:00
Hermet Park
b5fcc90e5d
loader/lottie: fix a wrong precomp time remapping.
...
the remapped frame number should be applied to the only referenced
precomp layer.
2023-09-07 17:59:52 +09:00
Hermet Park
a49ac81543
loader/lottie: support the repeater property
2023-09-07 12:17:16 +09:00
Hermet Park
2fab9fb7d9
loader/lottie: fix the incorrect viewport clip condition.
...
the viewport clip should be applied when it has a precomposition reference
but should not apply to image assets.
2023-09-07 12:17:16 +09:00
Hermet Park
dae6636d29
loader/lottie: filled a missing gradient stroke dash body.
2023-09-05 18:41:20 +09:00
Hermet Park
64a444aeb6
loader/lottie: support focal property in the radial gradient
2023-09-05 10:29:12 +09:00
Hermet Park
e0d1c947e6
infra: renamed the files for the consistency.
2023-09-04 17:26:43 +09:00
Hermet Park
ad9d9d0ecd
loader/lottie: support trimpath feature
2023-09-01 13:16:18 +09:00
Hermet Park
22771b5d8a
loader/lottie: fix a broken masking feature.
...
the inverse alpha should keep its own value.
previously, it's modified to alpha by a mistake.
2023-09-01 13:16:18 +09:00
Hermet Park
7c669f622f
loader/lottie: enhanced the coverage of the rounded corner feature.
...
Rounded corners should now be applied not only to rectangles
but also to path strokes. This enhancement changes the stroke join style
to round when a rounded corner is present.
Indeed, rounded corners ensure the accurate calculation of roundness based on the join style.
However, this patch has not yet been designed to handle it.
2023-09-01 13:16:18 +09:00
Hermet Park
07069f6640
loader/lottie: introduce chaining maskings more effectively.
2023-08-28 11:55:17 +09:00
Hermet Park
7b40c741ac
loader/lottie: correct a polystar transform.
...
Properly propagate the transform information to the merged shapes.
This corrects the incorrect transformation applied to the subsequent shapes.
2023-08-24 10:57:38 +09:00
Hermet Park
3d5c5ef0fa
loader/lottie: support the stroke offset property
2023-08-24 10:56:07 +09:00
Hermet Park
68f4193378
loader/lottie: support the polystar property.
2023-08-23 13:12:26 +09:00
Hermet Park
345b867c38
loader/lottie: optimize the matrix computation.
...
Do not multiply the matrices if either one is identity.
2023-08-22 21:25:42 +09:00
Hermet Park
b240e781d9
loader/lottie: ++optimization.
...
Removed intermediate scenes that were nothing more than transformations.
2023-08-22 21:25:37 +09:00
Hermet Park
664f028c15
loader/lottie: fix all data conversion compiler warnings on windows
2023-08-18 16:36:15 +09:00
Hermet Park
cf826bee5d
lottie/builder: --compiler warning on MacOS
2023-08-18 13:14:06 +09:00
Hermet Park
994c1b99a5
lottie/loader: support the masking features.
...
Enhancing the basic masking options by providing additional support.
2023-08-17 23:03:37 +09:00
Hermet Park
3b2c040f70
loader/lottie: add the missing solid color layer.
2023-08-17 23:03:37 +09:00
Hermet Park
5778bda4db
loader/lottie: do not build layers if the frame is out.
2023-08-15 15:49:10 +09:00