mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-04 13:45:17 +00:00
lottie: support group-level blending
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
previously, only layer-level blending was supported. Now, blending has been extended to support group-level as well.
This commit is contained in:
parent
581a304305
commit
74101421f9
3 changed files with 12 additions and 3 deletions
|
@ -198,11 +198,18 @@ void LottieBuilder::updateGroup(LottieGroup* parent, LottieObject** child, float
|
|||
if (!group->visible) return;
|
||||
|
||||
//Prepare render data
|
||||
group->scene = parent->scene;
|
||||
if (group->blendMethod == parent->blendMethod) {
|
||||
group->scene = parent->scene;
|
||||
} else {
|
||||
group->scene = tvg::Scene::gen();
|
||||
group->scene->blend(group->blendMethod);
|
||||
parent->scene->push(group->scene);
|
||||
}
|
||||
|
||||
group->reqFragment |= ctx->reqFragment;
|
||||
|
||||
//generate a merging shape to consolidate partial shapes into a single entity
|
||||
if (group->mergeable()) _draw(parent, nullptr, ctx);
|
||||
if (group->mergeable()) _draw(group, nullptr, ctx);
|
||||
|
||||
Inlist<RenderContext> contexts;
|
||||
auto propagator = group->mergeable() ? ctx->propagator : static_cast<Shape*>(PAINT(ctx->propagator)->duplicate(group->pooling()));
|
||||
|
|
|
@ -957,6 +957,7 @@ struct LottieGroup : LottieObject, LottieRenderPooler<tvg::Shape>
|
|||
|
||||
Scene* scene = nullptr;
|
||||
Array<LottieObject*> children;
|
||||
BlendMethod blendMethod = BlendMethod::Normal;
|
||||
|
||||
bool reqFragment : 1; //requirement to fragment the render context
|
||||
bool buildDone : 1; //completed in building the composition.
|
||||
|
@ -1006,7 +1007,6 @@ struct LottieLayer : LottieGroup
|
|||
} cache;
|
||||
|
||||
MaskMethod matteType = MaskMethod::None;
|
||||
BlendMethod blendMethod = BlendMethod::Normal;
|
||||
Type type = Null;
|
||||
bool autoOrient = false;
|
||||
bool matteSrc = false;
|
||||
|
|
|
@ -1079,6 +1079,8 @@ LottieObject* LottieParser::parseGroup()
|
|||
else if (KEY_AS("it")) {
|
||||
enterArray();
|
||||
while (nextArrayValue()) parseObject(group->children);
|
||||
} else if (KEY_AS("bm")) {
|
||||
group->blendMethod = (BlendMethod) getInt();
|
||||
} else skip();
|
||||
}
|
||||
group->prepare();
|
||||
|
|
Loading…
Add table
Reference in a new issue