For targets such as mac, this functionality compiles and renders the correct result either as literal:
var g:Graphics = graphics; g.drawPath([1, 2, 2, 2, 2], [20,10, 50,10, 50,40, 20,40, 20,10]);
Or, as typed collections:
var g:Graphics = graphics; var commands:Array<Int> = [1, 2, 2, 2, 2]; var data:Array<Float> = [20,10, 50,10, 50,40, 20,40, 20,10]; g.drawPath(commands, data);
Producing the result:
However targeting Flash or html5 is giving compiler errors.
With literals, both targets fail to compile giving error:
Source/Main.hx:13: characters 19-34 : Array should be flash.Vector
Source/Main.hx:13: characters 19-34 : For function argument ‘commands’
Source/Main.hx:13: characters 36-71 : Array should be openfl.Vector
Source/Main.hx:13: characters 36-71 : For function argument ‘data’
As typed collections, Flash target continues to give the same compiler error; however, html5 target builds but produces no visual result.
drawPath is defined as:
public function drawPath (commands:Array<Int>, data:Array<Float>, winding:GraphicsPathWinding = null):Void
Am I not passing expected parameters? Or, am I not implementing path drawing the way OpenFL expects?