Re: Advice on extending CanvasRenderingContext2D to support Depth Streams

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:

[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)?

Thanks,

-Anssi

[1] http://robert.ocallahan.org/2012/05/canvas-getcontext-mistake.html 

Received on Tuesday, 11 November 2014 10:09:34 UTC