Re: Advice on extending CanvasRenderingContext2D to support Depth Streams

Adding a new context type sounds reasonable to me. Just one question
though: do you really need to use a canvas at all? It seems like an
unnecessary indirection to me. For the use case in that example code
snippet, I thinkt what you would really want is an API for extracting the
DepthData of the current frame directly from the video element?

Also, you stated that the example should probably use rAF instead of
setInterval. I would suggest that depth data capture loop should be tied to
the incoming frame of the video stream, not to the display frame rate.
perhaps you should be using a listener attached to the video element's
'timeupdate' event.

On Tue, Nov 11, 2014 at 1:26 PM, Rik Cabanier <cabanier@gmail.com> wrote:

>
>
> 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 Wednesday, 12 November 2014 21:40:05 UTC