mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
loader/lottie: properly handle graident opacity attributes.
That property has been missed in the implementation.
This commit is contained in:
parent
8aa12ca468
commit
549f4b1308
3 changed files with 4 additions and 1 deletions
|
@ -241,6 +241,7 @@ static Shape* _updateFill(LottieGradientFill* fill, int32_t frameNo, RenderConte
|
||||||
//TODO: reuse the fill instance?
|
//TODO: reuse the fill instance?
|
||||||
ctx.propagator->fill(unique_ptr<Fill>(fill->fill(frameNo)));
|
ctx.propagator->fill(unique_ptr<Fill>(fill->fill(frameNo)));
|
||||||
ctx.propagator->fill(fill->rule);
|
ctx.propagator->fill(fill->rule);
|
||||||
|
ctx.propagator->opacity(MULTIPLY(fill->opacity(frameNo), PP(ctx.propagator)->opacity));
|
||||||
|
|
||||||
if (ctx.propagator->strokeWidth() > 0) ctx.propagator->order(true);
|
if (ctx.propagator->strokeWidth() > 0) ctx.propagator->order(true);
|
||||||
|
|
||||||
|
@ -595,7 +596,7 @@ static void _updateImage(LottieGroup* parent, LottieImage* image, int32_t frameN
|
||||||
if (auto matrix = PP(ctx.propagator)->transform()) {
|
if (auto matrix = PP(ctx.propagator)->transform()) {
|
||||||
picture->transform(*matrix);
|
picture->transform(*matrix);
|
||||||
}
|
}
|
||||||
picture->opacity(ctx.propagator->opacity());
|
picture->opacity(PP(ctx.propagator)->opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: remove duplicate.
|
//TODO: remove duplicate.
|
||||||
|
|
|
@ -94,6 +94,7 @@ struct LottieGradient
|
||||||
LottiePoint end = Point{0.0f, 0.0f};
|
LottiePoint end = Point{0.0f, 0.0f};
|
||||||
LottieFloat height = 0.0f;
|
LottieFloat height = 0.0f;
|
||||||
LottieFloat angle = 0.0f;
|
LottieFloat angle = 0.0f;
|
||||||
|
LottieOpacity opacity = 255;
|
||||||
LottieColorStop colorStops;
|
LottieColorStop colorStops;
|
||||||
uint8_t id = 0; //1: linear, 2: radial
|
uint8_t id = 0; //1: linear, 2: radial
|
||||||
};
|
};
|
||||||
|
|
|
@ -684,6 +684,7 @@ LottieRoundedCorner* LottieParser::parseRoundedCorner()
|
||||||
void LottieParser::parseGradient(LottieGradient* gradient, const char* key)
|
void LottieParser::parseGradient(LottieGradient* gradient, const char* key)
|
||||||
{
|
{
|
||||||
if (!strcmp(key, "t")) gradient->id = getInt();
|
if (!strcmp(key, "t")) gradient->id = getInt();
|
||||||
|
else if (!strcmp(key, "o")) parseProperty(gradient->opacity);
|
||||||
else if (!strcmp(key, "g"))
|
else if (!strcmp(key, "g"))
|
||||||
{
|
{
|
||||||
enterObject();
|
enterObject();
|
||||||
|
|
Loading…
Add table
Reference in a new issue