[whatwg] Extending clipping paths

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


On Sun, 15 Apr 2007, Jordan OSETE wrote:
> 
> Clipping-paths:
> ---------------
> Right now if i understand it correctly, the clip() function creates a new
> clipping path, being the intersection of the last clipping path.
> I have not seen any way to actually come back to a full clipping path, apart
> from calling restore() if you have saved it before, wich forces to save the
> clipping path each time you want to modify it.
> Also we can only intersect it, but not substract it or add anything to the
> current clipping path, wich are usual cliping path operations in drawing
> software.
> 
> A way to fix both would be to have some kind of property of the 2Dcontext
> object to select the operation (like globalCompositeOperation for painting).
> Operations like "add", "substract", "replace", "intersect" and "xor" come to
> mind (defaulting to "intersect").

On Sun, 15 Apr 2007, Maciej Stachowiak wrote:
> 
> I think you would want different methods for these if you had them. One reason
> the API works this way is that in the CoreGraphics drawing API on the Mac,
> there's no way to add anything to the clip region directly, so it would be
> necessary to track all the context state manually and union paths to support
> these operations.

On Mon, 16 Apr 2007, Jordan OSETE wrote:
> 
> Didn't know that. Being able to do other operations with clipping paths 
> would be useful, though. Wouldn't there a way to implement it in the UAs 
> itself for these cases, even if there is a slight loss of performance on 
> some systems? Unfortunately if we want to do another operation that is 
> not native, only the UA can implement it, not the web application.

Based on Maciej's response, and the fact that there is only little demand 
for this, I'm not going to add the feature to the spec. But I've noted it 
in the list of things for v3 of the <canvas> API.


> If that is not possible, a way to reset the clipping path to full 
> without having to call save/restore would still be appreciated.

I've also added this to the v3 list. Can you expand on the use case for 
this (e.g. sample plausibly production code that would do this)? It would 
be interesting to have some feedback from implementors about whether their 
libraries support it or not.

-- 
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