// Copyright 2018 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.scenic;

using fuchsia.images;
using fuchsia.mem;
using fuchsia.ui.gfx;

// Scenic.TakeScreenshot() returns a raw BGRA formatted image in this struct.
struct ScreenshotData {
  fuchsia.images.ImageInfo info;
  fuchsia.mem.Buffer data;
};

[Discoverable]
interface Scenic {
  // Create a new Session, which is the primary way to interact with Mozart.
  1: CreateSession(request<Session> session, SessionListener? listener);

  // Get information about the SceneManager's primary display.
  // TODO(MZ-453): in the future there will probably be a DisplayManager, and
  // info about which displays to use will be provided to the SceneManager.
  2: GetDisplayInfo() -> (fuchsia.ui.gfx.DisplayInfo info);
  // Gets an event signaled with displayOwnedSignal or displayNotOwnedSignal
  // when display ownership changes.
  3: GetDisplayOwnershipEvent() -> (handle<event> ownership_event);

  // Take a screenshot and return the data in |img_data|. |img_data| will
  // not contain BGRA data if |success| is false.
  // TODO(SCN-678): The permissions here are too wide (anyone can take a
  // screenshot), we should narrow them.
  4: TakeScreenshot() -> (ScreenshotData img_data, bool success);
};

const uint32 displayOwnedSignal = 0x02000000;
const uint32 displayNotOwnedSignal = 0x01000000;