Re: Advice on extending CanvasRenderingContext2D to support Depth Streams

On Tue, Nov 11, 2014 at 2:09 AM, Kostiainen, Anssi <
anssi.kostiainen@intel.com> wrote:

> Hi Rik,
>
> > On 11 Nov 2014, at 10:20, Rob Manson <roBman@buildAR.com> wrote:
> >
> >> Why don't you create a new canvas context type that just defines the
> >> methods that you need and add it to the HTML spec [1]?
> >>
> >> This will be much simpler to specify and you won't have to battle
> >> browser vendors that will almost certainly object.
> >> When implementing this new context, you can likely store a hidden 2D
> >> context that you draw the actual pixels into so you get HW acceleration
> >> for free.
> >
> > That's an excellent suggestion and thanks for the constructive feedback.
> >
> > This has created some good discussion amongst the editors and we'll
> definitely explore this option.
> >
> > We may also seek further advice from you and the public-canvas-api list
> based on all your experience with canvas contexts.
>
> Rik - thanks for the proposal.
>
> Re the API surface: given the getContext(type) extension point has its
> known issues (see [1]), I'd guess we'd be better off defining a getter such
> as getContextDepth() that returns a to-be-defined
> CanvasRenderingContextDepth object:
>

Roc's point was that the 'getContext' API should have been designed in a
different way, not that there should be only 1 type of context.
I'm unsure if I agree with him. I also never heard anyone complain about
the current approach.


> [omitting some details for brevity]
>
> partial interface CanvasRenderingContext2D {
>   CanvasRenderingContextDepth getContextDepth();
> };
>
> interface CanvasRenderingContextDepth {
>   DepthData createDepthData (/* ... */);
>   DepthData getDepthData (/* ... */);
>   void putDepthData (/* ... */);
>   // ...
> };
>
> Or do you think the ship has sailed and we should just reuse
> getContext(type)?
>

Yes, you can just reuse it.

Received on Tuesday, 11 November 2014 18:27:20 UTC