Canvas gradient comments

"The createLinearGradient(x0, y0, x1, y1) method takes four arguments 
that, after being subjected to the current transformation matrix, 
represent the start point (x0, y0) and end point (x1, y1) of the 
gradient." - that doesn't match reality. All implementations use the CTM 
at fill/stroke time, not at create(Linear|Radial)Gradient time.

Gradients should work the same as patterns: no transformation happens 
during creation, and the start/end points/circles are transformed by the 
CTM during the rendering step.


The behaviour outside the 0/1 stops is specified redundantly. The 
CanvasGradient bit says "Before the first stop, the color must be the 
color of the first stop". (That's not limited to the range [0, 1], as I 
read it). createLinearGradient says "at and before the starting point on 
the canvas the color at offset 0 is used". createRadialGradient says 
"Let the color at ω be the color of the gradient at offset 0.0 for all 
values of ω less than 0.0". Since linear and radial gradients have the 
same behaviour, it seems sensible to keep the CanvasGradient definition 
(and maybe be clear that it's not limited to [0, 1]) and delete the 
other two.


"When there are no stops, the gradient is transparent black." - should 
say "must be".

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Wednesday, 7 May 2008 18:22:46 UTC