summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2015-04-03 16:38:10 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:38:10 +0200
commit470d64c85e97ed8f36b305633359e02fc2bb2255 (patch)
tree1baa5c88a6267cc70de62a3aef7afe79e5f60cb7 /src
parentc44aa8f05d536c6e07f82c7ebf3d851ebf3c8864 (diff)
efl: update efl_gfx_shape interpolation to use fill color.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl/interfaces/efl_gfx_shape.c68
1 files changed, 37 insertions, 31 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c
index 9b2c1087e8..726d5715ce 100644
--- a/src/lib/efl/interfaces/efl_gfx_shape.c
+++ b/src/lib/efl/interfaces/efl_gfx_shape.c
@@ -275,11 +275,12 @@ interpolatei(int from, int to, double pos_map)
275 return (from * pos_map) + (to * (1.0 - pos_map)); 275 return (from * pos_map) + (to * (1.0 - pos_map));
276} 276}
277 277
278typedef struct _Efl_Gfx_Stroke Efl_Gfx_Stroke; 278typedef struct _Efl_Gfx_Property Efl_Gfx_Property;
279struct _Efl_Gfx_Stroke 279struct _Efl_Gfx_Property
280{ 280{
281 double scale; 281 double scale;
282 int r, g, b, a; 282 int r, g, b, a;
283 int fr, fg, fb, fa;
283 double w; 284 double w;
284 double centered; 285 double centered;
285 const Efl_Gfx_Dash *dash; 286 const Efl_Gfx_Dash *dash;
@@ -289,16 +290,17 @@ struct _Efl_Gfx_Stroke
289}; 290};
290 291
291static inline void 292static inline void
292stroke_get(const Eo *obj, Efl_Gfx_Stroke *stroke) 293gfx_property_get(const Eo *obj, Efl_Gfx_Property *property)
293{ 294{
294 eo_do(obj, 295 eo_do(obj,
295 stroke->scale = efl_gfx_shape_stroke_scale_get(), 296 property->scale = efl_gfx_shape_stroke_scale_get(),
296 efl_gfx_shape_stroke_color_get(&stroke->r, &stroke->g, &stroke->b, &stroke->a), 297 efl_gfx_shape_stroke_color_get(&property->r, &property->g, &property->b, &property->a),
297 stroke->w = efl_gfx_shape_stroke_width_get(), 298 efl_gfx_color_get(&property->fr, &property->fg, &property->fb, &property->fa),
298 stroke->centered = efl_gfx_shape_stroke_location_get(), 299 property->w = efl_gfx_shape_stroke_width_get(),
299 efl_gfx_shape_stroke_dash_get(&stroke->dash, &stroke->dash_length), 300 property->centered = efl_gfx_shape_stroke_location_get(),
300 stroke->c = efl_gfx_shape_stroke_cap_get(), 301 efl_gfx_shape_stroke_dash_get(&property->dash, &property->dash_length),
301 stroke->j = efl_gfx_shape_stroke_join_get()); 302 property->c = efl_gfx_shape_stroke_cap_get(),
303 property->j = efl_gfx_shape_stroke_join_get());
302} 304}
303 305
304static Eina_Bool 306static Eina_Bool
@@ -309,7 +311,7 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
309 Efl_Gfx_Path_Command *cmds; 311 Efl_Gfx_Path_Command *cmds;
310 double *pts, *from_pts, *to_pts; 312 double *pts, *from_pts, *to_pts;
311 unsigned int i, j; 313 unsigned int i, j;
312 Efl_Gfx_Stroke stroke_from, stroke_to; 314 Efl_Gfx_Property property_from, property_to;
313 Efl_Gfx_Dash *dash; 315 Efl_Gfx_Dash *dash;
314 316
315 from_pd = eo_data_scope_get(from, EFL_GFX_SHAPE_MIXIN); 317 from_pd = eo_data_scope_get(from, EFL_GFX_SHAPE_MIXIN);
@@ -320,10 +322,10 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
320 if (!_efl_gfx_shape_equal_commands_internal(from_pd, to_pd)) 322 if (!_efl_gfx_shape_equal_commands_internal(from_pd, to_pd))
321 return EINA_FALSE; 323 return EINA_FALSE;
322 324
323 stroke_get(from, &stroke_from); 325 gfx_property_get(from, &property_from);
324 stroke_get(to, &stroke_to); 326 gfx_property_get(to, &property_to);
325 327
326 if (stroke_from.dash_length != stroke_to.dash_length) return EINA_FALSE; 328 if (property_from.dash_length != property_to.dash_length) return EINA_FALSE;
327 329
328 cmds = realloc(pd->commands, 330 cmds = realloc(pd->commands,
329 sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); 331 sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count);
@@ -367,33 +369,37 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
367 to_pd->current_ctrl.y, 369 to_pd->current_ctrl.y,
368 pos_map); 370 pos_map);
369 371
370 dash = malloc(sizeof (Efl_Gfx_Dash) * stroke_to.dash_length); 372 dash = malloc(sizeof (Efl_Gfx_Dash) * property_to.dash_length);
371 if (dash) 373 if (dash)
372 { 374 {
373 for (i = 0; i < stroke_to.dash_length; i++) 375 for (i = 0; i < property_to.dash_length; i++)
374 { 376 {
375 dash[i].length = interpolate(stroke_from.dash[i].length, 377 dash[i].length = interpolate(property_from.dash[i].length,
376 stroke_to.dash[i].length, pos_map); 378 property_to.dash[i].length, pos_map);
377 dash[i].gap = interpolate(stroke_from.dash[i].gap, 379 dash[i].gap = interpolate(property_from.dash[i].gap,
378 stroke_to.dash[i].gap, pos_map); 380 property_to.dash[i].gap, pos_map);
379 } 381 }
380 } 382 }
381 else 383 else
382 { 384 {
383 stroke_to.dash_length = 0; 385 property_to.dash_length = 0;
384 } 386 }
385 387
386 eo_do(obj, 388 eo_do(obj,
387 efl_gfx_shape_stroke_scale_set(interpolate(stroke_to.scale, stroke_from.scale, pos_map)), 389 efl_gfx_shape_stroke_scale_set(interpolate(property_to.scale, property_from.scale, pos_map)),
388 efl_gfx_shape_stroke_color_set(interpolatei(stroke_to.r, stroke_from.r, pos_map), 390 efl_gfx_shape_stroke_color_set(interpolatei(property_to.r, property_from.r, pos_map),
389 interpolatei(stroke_to.g, stroke_from.g, pos_map), 391 interpolatei(property_to.g, property_from.g, pos_map),
390 interpolatei(stroke_to.b, stroke_from.b, pos_map), 392 interpolatei(property_to.b, property_from.b, pos_map),
391 interpolatei(stroke_to.a, stroke_from.a, pos_map)), 393 interpolatei(property_to.a, property_from.a, pos_map)),
392 efl_gfx_shape_stroke_width_set(interpolate(stroke_to.w, stroke_from.w, pos_map)), 394 efl_gfx_color_set(interpolatei(property_to.fr, property_from.fr, pos_map),
393 efl_gfx_shape_stroke_location_set(interpolate(stroke_to.centered, stroke_from.centered, pos_map)), 395 interpolatei(property_to.fg, property_from.fg, pos_map),
394 efl_gfx_shape_stroke_dash_set(dash, stroke_to.dash_length), 396 interpolatei(property_to.fb, property_from.fb, pos_map),
395 efl_gfx_shape_stroke_cap_set(pos_map < 0.5 ? stroke_from.c : stroke_to.c), 397 interpolatei(property_to.fa, property_from.fa, pos_map)),
396 efl_gfx_shape_stroke_join_set(pos_map < 0.5 ? stroke_from.j : stroke_to.j), 398 efl_gfx_shape_stroke_width_set(interpolate(property_to.w, property_from.w, pos_map)),
399 efl_gfx_shape_stroke_location_set(interpolate(property_to.centered, property_from.centered, pos_map)),
400 efl_gfx_shape_stroke_dash_set(dash, property_to.dash_length),
401 efl_gfx_shape_stroke_cap_set(pos_map < 0.5 ? property_from.c : property_to.c),
402 efl_gfx_shape_stroke_join_set(pos_map < 0.5 ? property_from.j : property_to.j),
397 403
398 eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL), 404 eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL),
399 eo_event_callback_call(EFL_GFX_CHANGED, NULL)); 405 eo_event_callback_call(EFL_GFX_CHANGED, NULL));