From: subhransu mohanty Date: Mon, 12 Nov 2018 06:48:09 +0000 (+0900) Subject: lottie/example: update example with gradient support for efl renderer. X-Git-Tag: submit/tizen/20181129.071502~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0456101661e6dcd99f1ece2bb91c10992c7c639;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/example: update example with gradient support for efl renderer. Change-Id: I44bad80372b197572368bae45f109e81a2a4a989 --- diff --git a/example/lottieview.cpp b/example/lottieview.cpp index be9f2a1..623e154 100644 --- a/example/lottieview.cpp +++ b/example/lottieview.cpp @@ -72,7 +72,35 @@ void LottieView::createVgNode(LOTNode *node, Efl_VG *parent) } } else if (node->mBrushType == LOTBrushType::BrushGradient) { - //TODO fill the gradient info + Efl_VG *grad = nullptr; + if (node->mGradient.type == GradientLinear) { + grad = evas_vg_gradient_linear_add(parent); + evas_vg_gradient_linear_start_set(grad, node->mGradient.start.x, node->mGradient.start.y); + evas_vg_gradient_linear_end_set(grad, node->mGradient.end.x, node->mGradient.end.y); + } else { + grad = evas_vg_gradient_radial_add(parent); + evas_vg_gradient_radial_center_set(grad, node->mGradient.center.x, node->mGradient.center.y); + evas_vg_gradient_radial_radius_set(grad, node->mGradient.cradius); + evas_vg_gradient_radial_focal_set(grad, node->mGradient.focal.x, node->mGradient.focal.y); + } + int stop_count = node->mGradient.stopCount; + if (stop_count) + { + Efl_Gfx_Gradient_Stop *stops = (Efl_Gfx_Gradient_Stop *)calloc(stop_count, sizeof(Efl_Gfx_Gradient_Stop)); + for (int i = 0; i mGradient.stopPtr[i].pos; + stops[i].r = (node->mGradient.stopPtr[i].r * node->mGradient.stopPtr[i].a)/255; + stops[i].g = (node->mGradient.stopPtr[i].g * node->mGradient.stopPtr[i].a)/255; + stops[i].b = (node->mGradient.stopPtr[i].b * node->mGradient.stopPtr[i].a)/255; + stops[i].a = node->mGradient.stopPtr[i].a; + } + evas_vg_gradient_stop_set(grad, stops, stop_count); + } + if (node->mStroke.enable) { + evas_vg_shape_stroke_fill_set(shape, grad); + } else { + evas_vg_shape_fill_set(shape, grad); + } } }