forked from enlightenment/efl
efl: add efl_graphics_path_interpolate and efl_graphics_path_equal_commands.
This function will be handy to implement path interpolation in Edje later on. This would be usable by Edje if we do push an Evas_Object_Shape. Not really difficult to add at this stage.
This commit is contained in:
parent
2cae706ab6
commit
0bb66ffedf
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <Efl.h>
|
#include <Efl.h>
|
||||||
|
|
||||||
static unsigned int
|
static inline unsigned int
|
||||||
efl_graphics_path_command_length(Efl_Graphics_Path_Command command)
|
efl_graphics_path_command_length(Efl_Graphics_Path_Command command)
|
||||||
{
|
{
|
||||||
switch (command)
|
switch (command)
|
||||||
|
@ -95,6 +95,36 @@ efl_graphics_path_dup(Efl_Graphics_Path_Command **out_cmd, double **out_pts,
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
efl_graphics_path_equal_commands(const Efl_Graphics_Path_Command *a,
|
||||||
|
const Efl_Graphics_Path_Command *b)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!a && !b) return EINA_TRUE;
|
||||||
|
if (!a || !b) return EINA_FALSE;
|
||||||
|
|
||||||
|
for (i = 0; a[i] == b[i] && a[i] != EFL_GRAPHICS_PATH_COMMAND_TYPE_END; i++)
|
||||||
|
;
|
||||||
|
|
||||||
|
return a[i] == b[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
efl_graphics_path_interpolate(const Efl_Graphics_Path_Command *cmd,
|
||||||
|
double pos_map,
|
||||||
|
const double *from, const double *to, double *r)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
if (!cmd) return ;
|
||||||
|
|
||||||
|
for (i = 0; cmd[i] != EFL_GRAPHICS_PATH_COMMAND_TYPE_END; i++)
|
||||||
|
for (j = 0; j < efl_graphics_path_command_length(cmd[i]); j++)
|
||||||
|
*r = (*from) * pos_map + ((*to) * (1.0 - pos_map));
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
efl_graphics_path_append_move_to(Efl_Graphics_Path_Command **commands, double **points,
|
efl_graphics_path_append_move_to(Efl_Graphics_Path_Command **commands, double **points,
|
||||||
double x, double y)
|
double x, double y)
|
||||||
|
|
|
@ -46,4 +46,13 @@ efl_graphics_path_append_circle(Efl_Graphics_Path_Command **commands, double **p
|
||||||
double x, double y, double radius);
|
double x, double y, double radius);
|
||||||
|
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
efl_graphics_path_interpolate(const Efl_Graphics_Path_Command *cmd,
|
||||||
|
double pos_map,
|
||||||
|
const double *from, const double *to, double *r);
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
efl_graphics_path_equal_commands(const Efl_Graphics_Path_Command *a,
|
||||||
|
const Efl_Graphics_Path_Command *b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue