[whatwg] CanvasPattern::CreatePattern - Optional Arguments

Ian Hickson ian at hixie.ch
Wed May 17 08:23:27 PDT 2006

On Mon, 5 Dec 2005, Joebert wrote:
> 6.1.1. The 2D context
> interface CanvasRenderingContext2D
> CanvasPattern createPattern(in HTMLImageElement image, DOMString
> repetition);
> CanvasPattern createPattern(in HTMLCanvasElement image, DOMString
> repetition);
> I would like to see optional source x (sx), source y (sy), source width 
> (sw), source height (sh) arguments added to the "createPattern" method. 
> Example: CanvasPattern createPattern(in HTMLImageElement image, 
> DOMString repetition, in float sx, in float sy, in float sw, in float 
> sh);
> As of now, if a pattern needs to be created from a section of an image 
> consisting of multiple pattern sections, one needs to create a temp/clip 
> canvas where "drawImage" can extract the section, then pass the 
> temp/clip canvas to the "createPattern" method.
> The optional arguments (sx, sy, sw, sh) would streamline pattern 
> creations of this nature.

While I agree that this would be a useful feature, we're trying to avoid 
adding any features that can be implemented in other ways (e.g. as you 
describe with a second canvas). The feedback I've received from Web 
browser vendors is that they'd rather avoid feature creep like this.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list