So, after some tries.
I confirm.
for HTML5 Gradient Fill
1- rectify CanvasGraphics.hx
in private static function createGradientPattern function :
…
case LINEAR
…
point = Point.__pool.get ();
point.setTo (0, 0); // <-------------- here.
matrix.__transformPoint (point);
…
point2 = Point.__pool.get ();
point2.setTo (100, 0); // <-------------- .
matrix.__transformPoint (point2);
…
I tried with greater value to see if the gradient was smoother set with higher resolution, without clue.
So I kept 100.
But then, you have to scale your gradientfill with a Matrix xScale calculated for your fill size.
Something like that :
package;
import openfl.display.GradientType;
import openfl.display.Sprite;
import openfl.geom.Matrix;
class GradientFill extends Sprite
{
public function new()
{
super();
var width = 1920;
var height = 1080;
var matrix:Matrix = new Matrix( width / 100, 0, 0, 1, 0, 0 );
graphics.beginGradientFill( GradientType.LINEAR, [0x0000FF, 0x00FF00], [1, 1], [0, 255], matrix );
graphics.drawRect( 0, 0, width, height );
}
}
If I remember well, because a vertical linear gradient is just an oriented ones… or maybe just inverting width/100 by height/100 on the same matrix, and the linear rotation matrix was doing the rest of the job.
So you retrieve well
![gradientFill-02](//community.openfl.org/uploads/default/original/2X/2/2716b976d60b83ccbd9a2d563f31d52fdf03c02f.jpeg)
But at that time, Flash gradient were accurate, weren’t they ?
Now, they are not anymore.
They are weird like Neko/Windows ones.
Any hint where to check ?
I’m losing myself in drawCommanderBuffer/Reader.