blob: b2651e77267501932361400c893d9f5e9e66d487 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.sketchy;
using fuchsia.images;
// A Canvas allows clients to draw strokes, which are dynamically tessellated
// and inserted into the global Scenic scene-graph.
[Discoverable]
interface Canvas {
// Init() must be called once, before invoking any other operations.
1: Init(CanvasListener? listener);
// Enqueue a list of operations, which will not take effect until Present() is
// called. It is allowable to call Enqueue() several times before calling
// Present(); the effect is the same as if all operations had been
// concatenated into a single Enqueue() call.
//
// Akin to fuchsia::ui::gfx::Session.Enqueue(); see scenic/session.fidl for details.
2: Enqueue(vector<Command> commands);
// Present all previously enqueued operations. In order to pipeline the
// preparation of the resources required to render the scene, two lists of
// fences (implemented as events) are passed.
//
// Akin to fuchsia::ui::gfx::Session.Present(); see scenic/session.fidl for details.
3: Present(uint64 presentation_time) ->
(fuchsia.images.PresentationInfo presentation_info);
};
// Allows clients to observe canvas events.
interface CanvasListener {
1: OnError(string description);
2: OnStrokeFinished(uint32 stroke_id, StrokePath path);
3: OnPageViewerInvalidated(uint32 viewer_id);
};