| // 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.examples.shadertoy; |
| |
| using fuchsia.images; |
| using zx; |
| |
| // ShadertoyFactory provides a number of methods for creating `Shadertoy` |
| // instances. |
| @discoverable |
| protocol ShadertoyFactory { |
| // Create a new Shadertoy that will present its rendered content to |
| // `image_pipe`. |
| NewImagePipeShadertoy(resource struct { |
| toy server_end:Shadertoy; |
| image_pipe client_end:fuchsia.images.ImagePipe2; |
| }); |
| |
| // Create a new Shadertoy and a new view for it to render into. |
| // If `handle_input_events` is true, then mouse/touch events will be |
| // automatically handled by the Shadertoy; in this case, invocations of |
| // Shadertoy.SetMouse() will be ignored. Otherwise, the view will ignore |
| // input events, and SetMouse() will behave normally. |
| // TODO(fxbug.dev/23474): not implemented. |
| NewViewShadertoy(resource struct { |
| toy server_end:Shadertoy; |
| view_token zx.handle:EVENTPAIR; |
| handle_input_events bool; |
| }); |
| }; |