| // 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] |
| protocol Canvas { |
| // Init() must be called once, before invoking any other operations. |
| 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. |
| 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. |
| Present(uint64 presentation_time) |
| -> (fuchsia.images.PresentationInfo presentation_info); |
| }; |
| |
| // Allows clients to observe canvas events. |
| protocol CanvasListener { |
| OnError(string description); |
| OnStrokeFinished(uint32 stroke_id, StrokePath path); |
| OnPageViewerInvalidated(uint32 viewer_id); |
| }; |