//scaling using scale * width
double scale;
- //thorvg don't supported visibility, implementation is based on alpha change for stroke
- //and fill, but color have to be saved here to recreate it when visibility will be changed back
- Tvg_Color stroke_color;
- Tvg_Color fill_color;
-
//Flag indicates if shape was pushed to canvas. Shape has access to canvas only in
//render function which may be called multiple times, and shape should be pushed
//only once.
//Flag indicates if shape was started. It is used to store start position
//and keep shape current point valid when shape close API is called.
Eina_Bool started;
-
- //Used to compare it with node data. Don't call visibility change if it has the same value
- Eina_Bool visibility;
-
#endif
};
#ifdef HAVE_THORVG
static void
-_visibility_set(Efl_Canvas_Vg_Node_Data *nd)
-{
- Efl_Canvas_Vg_Shape_Data *sd = NULL;
-
- if (!nd || !nd->data) return;
- sd = nd->data;
-
- if (sd->visibility == nd->visibility) return;
- sd->visibility = nd->visibility;
-
- if (nd->visibility == EINA_FALSE)
- {
- tvg_shape_get_stroke_color(sd->shape,
- &sd->stroke_color.r,
- &sd->stroke_color.g,
- &sd->stroke_color.b,
- &sd->stroke_color.a);
-
- tvg_shape_get_fill_color(sd->shape,
- &sd->fill_color.r,
- &sd->fill_color.g,
- &sd->fill_color.b,
- &sd->fill_color.a);
-
- tvg_shape_set_stroke_color(sd->shape, 0, 0, 0, 0);
- tvg_shape_set_fill_color(sd->shape, 0, 0, 0, 0);
- }
- else
- {
- tvg_shape_set_stroke_color(sd->shape,
- sd->stroke_color.r,
- sd->stroke_color.g,
- sd->stroke_color.b,
- sd->stroke_color.a);
-
- tvg_shape_set_fill_color(sd->shape,
- sd->fill_color.r,
- sd->fill_color.g,
- sd->fill_color.b,
- sd->fill_color.a);
- }
-}
-static void
_convert_eina_to_tvg_mat(const Eina_Matrix3 *eina_mat, Tvg_Matrix *tvg_mat)
{
if (!eina_mat || !tvg_mat) return;
tvg_paint_transform(sd->shape, &trans_mat);
}
- _visibility_set(nd);
if (sd->pushed == EINA_FALSE)
{
//get fill color and set it
efl_gfx_color_get(obj, &r, &g, &b, &a);
tvg_shape_set_fill_color(sd->shape, r, g, b, a);
+ uint8_t opacity = nd->visibility ? 255 : 0;
+ tvg_paint_set_opacity(sd->shape, nd->visibility);
tvg_canvas_update_paint((Tvg_Canvas *) canvas, sd->shape);
}
#endif
#else
nd->render_pre_tvg = _efl_canvas_vg_shape_render_pre_tvg;
pd->shape = tvg_shape_new();
- pd->visibility = EINA_TRUE;
pd->scale = 1.0;
#endif