src/RendererUtils.hpp
// Applies deform filter on cairo path
Applies deform filter on cairo path
Applies deform filter on cairo path
void path_deform(cairo_t* ctx, std::string& deform_x, std::string& deform_y, double progress){
        mu::Parser parser_x, parser_y;
        double x_buf, y_buf;
        parser_x.DefineConst("t", progress);
        parser_y.DefineConst("t", progress);
        parser_x.DefineVar("x", &x_buf);
        parser_y.DefineVar("x", &x_buf);
        parser_x.DefineVar("y", &y_buf);
        parser_y.DefineVar("y", &y_buf);
        parser_x.SetExpr(deform_x);
        parser_y.SetExpr(deform_y);
        cairo_path_filter(ctx,
            [&parser_x,&parser_y,&x_buf,&y_buf](double& x, double& y){
                x_buf = x;
                y_buf = y;
                try{
                    x = parser_x.Eval();
                    y = parser_y.Eval();
                }catch(...){}
            });
    }
void path_deform ( cairo_t * ctx , std :: string & deform_x , std :: string & deform_y , double progress ) { mu :: Parser parser_x , parser_y ; double x_buf , y_buf ; parser_x . DefineConst ( " " , progress ) ; parser_y . DefineConst ( " " , progress ) ; parser_x . DefineVar ( " " , & x_buf ) ; parser_y . DefineVar ( " " , & x_buf ) ; parser_x . DefineVar ( " " , & y_buf ) ; parser_y . DefineVar ( " " , & y_buf ) ; parser_x . SetExpr ( deform_x ) ; parser_y . SetExpr ( deform_y ) ; cairo_path_filter ( ctx , [ & parser_x , & parser_y , & x_buf , & y_buf ] ( double & x , double & y ) { x_buf = x ; y_buf = y ; try { x = parser_x . Eval ( ) ; y = parser_y . Eval ( ) ; } catch ( ... ) { } } ) ; }
Applies deform filter on cairo path
Applies deform filter on cairo path