put poly function on CanvasContext2D