blob: 9640e69fef12aca6b3b5495989a6a71ddb80c9c2 [file] [log] [blame] [edit]
// Copyright 2021 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.composition;
alias ImageId = uint64;
/// The enum of possible errors following a [`CreateImage`] call.
type CreateImageError = strict enum {
/// One or more arguments are missing in [`CreateImageArgs`].
MISSING_ARGS = 1;
/// A general error occurred in [`CreateImage`].
BAD_OPERATION = 2;
};
/// The table of arguments passed into the [`CreateImage`] call. Note that all
/// fields are necessary.
type CreateImageArgs = resource table {
/// The image ID for the image about to be created. It must be unique, and
/// may not be 0, which is invalid.
1: image_id ImageId;
/// The import token referencing a BufferCollection registered with
/// Allocator. This function will fail unless all clients of the specified
/// BufferCollection have set their constraints.
2: import_token BufferCollectionImportToken;
/// The VMO index must be valid and in the range of constraints of the specified
/// BufferCollection.
3: vmo_index uint32;
/// image_width must be valid and in the range of constraints of the specified
/// BufferCollection.
4: image_width uint32;
/// image_height must be valid and in the range of constraints of the specified
/// BufferCollection.
5: image_height uint32;
};
/// This protocol provides a low-level Screenshot API for clients to use.
/// Screenshot clients should familiarize themselves with the sysmem and
/// Allocator protocols as those are necessary to create the BufferCollections
/// and images Screenshot uses.
protocol Screenshot {
/// Clients should first use the Allocator protocol to register a
/// BufferCollection for screenshot use.
///
/// Afterwards, clients should create the image that will eventually be
/// rendered to using this method.
///
/// Finally, clients can use their specified `ImageId` in TakeScreenshot().
CreateImage(resource struct {
args CreateImageArgs;
}) -> (struct {}) error CreateImageError;
};