Search code examples
phpdrawcurve

Equivalent of quadraticCurveTo in PHP


i'm searching for an equivalent of the javascript function quadraticCurveTo in php.

ctx.moveTo(this.fromX,this.fromY);
ctx.quadraticCurveTo(this.controlX, this.controlY, this.toX, this.toY);

My script gets the variables (fromx,fromy,controlx...) from POST and i want to draw the curve with GD or anything else.

Edit: Resolved! See my comment


Solution

  • i found how to do it. I used Imagemagick here is the code.

    $draw->pathStart();
    $draw->pathLineToAbsolute($arrow[0], $arrow[1]);
    $draw->pathCurveToQuadraticBezierAbsolute($arrow[2], $arrow[3],$arrow[4], $arrow[5]);
    $draw->PathFinish();