blob: 7b0cc1174ee7e0cfca514129110f5bafe446108c [file] [log] [blame]
// 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.
enum CreateImageError {
/// 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.
resource table CreateImageArgs {
/// The image ID for the image about to be created. It must be unique, and
/// may not be 0, which is invalid.
1: ImageId image_id;
/// 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: BufferCollectionImportToken import_token;
/// The VMO index must be valid and in the range of constraints of the specified
/// BufferCollection.
3: uint32 vmo_index;
/// image_width must be valid and in the range of constraints of the specified
/// BufferCollection.
4: uint32 image_width;
/// image_height must be valid and in the range of constraints of the specified
/// BufferCollection.
5: uint32 image_height;
};
/// 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(CreateImageArgs args) -> () error CreateImageError;
};