W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

Re: [whatwg] remove resetClip from the Canvas 2D spec

From: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 29 Jan 2013 20:59:13 -0800
Message-ID: <CAGN7qDAvHcFoGwyu6Ak2aSusGEgoFiZzDgpp7YhXQ2AyCNuWOA@mail.gmail.com>
To: Charles Pritchard <chuck@jumis.com>
Cc: WHATWG List <whatwg@whatwg.org>, "public-canvas-api@w3.org" <public-canvas-api@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
On Tue, Jan 29, 2013 at 8:28 PM, Charles Pritchard <chuck@jumis.com> wrote:

> On 1/29/2013 8:23 PM, Tab Atkins Jr. wrote:
>
>> On Tue, Jan 29, 2013 at 6:10 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>>
>>> It restores the graphics state back to the state at 'save' time and this
>>> includes the clip area.
>>> 'Clip' is a nested operation so every clip will be the intersection of
>>> the
>>> existing clip area and the new one.
>>>
>>> PDF also has no initclip/resetClip and since CG is based on that model,
>>> maybe they didn't bother to add it.
>>> I can certainly see its use though (it's used quite often in PostScript)
>>>
>> I find that bizarre, but I've seen weirder APIs, so whatever.
>>
>> It may still be possible without being too hacky - if the UA manually
>> rewinds and replays the state stack, only omitting clip() changes, it
>> would be the same thing.  You'd have to be clever to allow the user to
>> restore() from that state again, though - maybe by recording the stack
>> of clip() operations and doing *another* rewind+replay, but this time
>> with the clip() calls happening again.
>>
>> My definition of "not too hacky" may be miscalibrated.
>>
>>
> Do we want to consider PDF as a target for discussion? It seems more
> appropriate than Apple's documented (and undocumented) APIs.
>

No, I mentioned the PDF angle just for my own interest. Better to stick
with the available APIs


>
> Within PDF, we'd be rebuilding the state -- doing a full restore(), then
> replaying the existing state upon resetClip().
>
> I've had worse experiences with PDF. Transformations come to mind.
>
> That said, the point of this API was to optimize the implementation, I
> believe, not to simply make things easier on the developer.
>

I'm unfamiliar with the history. If so, that is definitely not the case for
CoreGraphics and at first glance not for Direct2D either.


> It seems likely that this will not be an optimization for the Apple stack
> any time soon.


No, it looks like there was a transition API 'ClipCGContextToRegion' that
let you remove the clip, but it was removed.

Rik
Received on Wednesday, 30 January 2013 04:59:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT