From 5f9c54a1b2724abcb02ba0a70640a927a1f67ccc Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Thu, 26 Oct 2017 10:59:16 +0900 Subject: [PATCH] triangulator:Added stroke_set api to the triangulator_stroker. --- .../triangulator/triangulator_stroker.c | 14 ++++++++++++++ .../triangulator/triangulator_stroker.h | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/static_libs/triangulator/triangulator_stroker.c b/src/static_libs/triangulator/triangulator_stroker.c index a1d06657f0..cf07bec5a3 100644 --- a/src/static_libs/triangulator/triangulator_stroker.c +++ b/src/static_libs/triangulator/triangulator_stroker.c @@ -21,6 +21,20 @@ triangulator_stroker_free(Triangulator_Stroker *stroker) eina_inarray_free(stroker->arc_pts); } +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m) +{ + float scale_factor = 1.0; + if (m) + { + // get the minimum scale factor from matrix + scale_factor = m->xx < m->yy ? m->xx : m->yy; + } + stroker->width = (width * scale_factor)/2; + stroker->join_style = join_style; + stroker->cap_style = cap_style; +} + // calculate the normal vector static void normal_vector(float x1, float y1, float x2, float y2, float width, diff --git a/src/static_libs/triangulator/triangulator_stroker.h b/src/static_libs/triangulator/triangulator_stroker.h index 2dee4290e4..4cb0f3e2a4 100644 --- a/src/static_libs/triangulator/triangulator_stroker.h +++ b/src/static_libs/triangulator/triangulator_stroker.h @@ -38,6 +38,9 @@ Triangulator_Stroker *triangulator_stroker_new(void); */ void triangulator_stroker_free(Triangulator_Stroker *stroker); +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m); + /** * Process the command list to generate triangle strips. * The alogrithm handles multiple contour by adding invisible triangles. @@ -48,7 +51,7 @@ void triangulator_stroker_free(Triangulator_Stroker *stroker); * pt_count : number of points. * * output : It generates the outline in the form of triangle strips store in vertices array. - * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. + * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. */ void triangulator_stroker_process(Triangulator_Stroker *stroker, const Efl_Gfx_Path_Command *cmds, const double *pts, int cmd_count, int pt_count);