Re: Some comments on The Canvas 2D API 1.0 Specification

Re Erik Dahlstrom's mail on Mon, 07 Sep 2009 14:54:29 +0200

>2.1. The canvas interface element
>> interface CanvasElement : Element
>Why does the interface need to inherit from Element? Isn't it more  
>straightforward that the element that wants to use the canvas  
>functionality inherits the CanvasElement interface instead? I'd prefer it  
>if the CanvasElement interface was completely standalone.

Inheriting from Element seems natural...Could you elaborate on 'more straightforward'?

>3.3 Compositing
>> lighter  A plus B. Display the sum of the source image and destination  
>> image, with color values approaching 1 as a limit.
>Why isn't this named 'plus' or 'add' instead? 'plus' would be consistent  
>with PorterDuff, 'add' might be better if there's an intention to add a  
>'subtract' mode in the future.
>Note that it's possible to confuse this with the 'lighten' blendmode,  
>http://www.w3.org/TR/SVG11/filters.html#feBlend.

Safari 4 supports 'lighter' and 'darker' today.
Is your proposal to change 'lighten' to 'add'? I don't think this change is worth the compat impact, but I'd love to hear more opinions.

>> vendorName-operationName  Vendor-specific extensions to the list of  
>> composition operators should use this syntax.
>Why is this needed? Isn't the getContext() method enough to deal with  
>vendor-extensions?

IMHO using a vendor-specific tag to an existing method using this mechanism is fine.
To check if a particular vendor-specific tag is supported, the following could be used: 

previous = context.globalCompositeOperation;
context.globalCompositeOperation = vendor-specific;
if (previous != context.globalCompositeOperation) do the vendor-specific drawing
(This relies on the "Unknown values are ignored" part of the spec)

IMHO getContent(vendor-extension) should be used when the vendor wants to add new *methods*. 


>3.10 Images
>> Each of those three can take either an HTMLImageElement, an  
>> HTMLCanvasElement, or an HTMLVideoElement for the image argument.
>It would be good to allow this set to be extended, e.g with  
>SVGImageElement. The same also applies to the createPattern method. It  
>wouldn't be natural to use HTMLImageElements in an all-svg document.
>6. Security with Canvas Interface Elements
>Should probably be extended to deal with other inputs, e.g SVGImageElement.

Agreed; I like the idea of adding this to the spec. Other opinions?

Thanks
Frank Olivier, Program Manager, Microsoft

Received on Thursday, 1 October 2009 18:56:20 UTC