[whatwg] Canvas save/restore functionality

Ian Hickson ian at hixie.ch
Fri May 11 13:05:33 PDT 2007

On Sun, 15 Apr 2007, Jordan OSETE wrote:
> Save-restore:
> -------------
> Instead of having a last-in-first-out-like save-restore mecanism, why not
> return an object with save() that could be restored with restore(obj)?
> Maybe changing the names of the methods to keep it backward compatible.
> This would give much additionnal flexibility.
> Also, maybe saving everything at once is not always needed. Independant
> save/restore methods for clipping paths, actual paths, transformations,
> stroke/fill styles and shadows (have i forgotten something?) would be even
> more versatile, and allow for better performance sometimes (saving only what
> is needed).

On Sun, 15 Apr 2007, Maciej Stachowiak wrote:
> Many graphics APIs (including CoreGraphics) have a built-in LIFO model for
> save/restore, so it's likely to actually lead to worse performance to support
> fine-grained save/restore on such systems.

On Mon, 16 Apr 2007, Jordan OSETE wrote:
> Hm, unfortunate. Well, if there is a way to restore to a full clipping 
> path without that, it is less important for me.

Based on the above discussion, and the low level of demand, I'm going to 
leave the save/restore functionality as-is for now. I've noted the 
clipping restoration request in the spec as a possibly future canvas 

Thanks for your feedback,
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