triangulator:Added stroke_set api to the triangulator_stroker.

This commit is contained in:
subhransu mohanty 2017-10-26 10:59:16 +09:00 committed by Jean-Philippe Andre
parent 3b7607d7f6
commit 5f9c54a1b2
2 changed files with 18 additions and 1 deletions

View File

@ -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,

View File

@ -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);