// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file is copied from // https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform2/odml/mojom/mantis_processor.mojom // Doc: go/mantis-bl-dd module mantis.mojom; // A specific error Mantis encountered when processing the request. [Stable, Extensible] enum MantisError { [Default] kUnknownError, [MinVersion=1] kProcessorNotInitialized, [MinVersion=1] kInputError, [MinVersion=1] kProcessFailed, [MinVersion=2] kMissingSegmenter, [MinVersion=3] kInputSafetyError, [MinVersion=3] kOutputSafetyError, [MinVersion=3] kPromptSafetyError, }; // The result of image after processed by Mantis, or an error if any. [Stable] union MantisResult { MantisError error; array result_image; }; // This enum type identifies the result of Trust & Safety checking. [Stable, Extensible] enum SafetyClassifierVerdict { kPass, [Default] kFail, [MinVersion=3] kFailedText, [MinVersion=3] kFailedImage, [MinVersion=4] kServiceNotAvailable, [MinVersion=5] kNoInternetConnection, }; // Struct that is used to represent a single point (x, y) in a // stroke for use in e.g. handwriting recognition. (x, y) are coordinates // in world space, with units in Density-Independent Pixels (DIP). // The event fields are defined in: // http://google3/third_party/sketchology/proto/scene_change.proto;l=123;rcl=693325121 [Stable] struct TouchPoint { float x@0; float y@1; }; // This enum type identifies the segmentation mode. [Stable, Extensible] enum SegmentationMode { [Default] kScribble, kLasso, }; // Interface for processing images. The processor should already be initialized // by `MantisService`. // // This interface is served by `odmld` process in CrOS to be used by image // editing UI (e.g. Media App WebUI). [Stable] interface MantisProcessor { // Inpaints the image based on the mask and seed. Pass the same `seed` across // method calls to get identical result. The `image`, `mask`, and `result` are // byte arrays containing the encoded format of an image (e.g., PNG, JPEG). Inpainting@0(array image, array mask, uint32 seed) => (MantisResult result); // Fills the image generatively based on the text and seed. Pass the same // `seed` across method calls to get identical result. The `image`, `mask`, // and `result` are byte arrays containing the encoded format of an image // (e.g., PNG, JPEG). GenerativeFill@1( array image, array mask, uint32 seed, string prompt) => (MantisResult result); // Performs image segmentation on the image based on the prior selection. // The `image`, `prior`, and `result` are byte arrays containing the // encoded format of an image (e.g., PNG, JPEG). [MinVersion=1] Segmentation@2(array image, array prior) => (MantisResult result); // Classifies image for Trust & Safety checking. [MinVersion=2] ClassifyImageSafety@3(array image) => (SafetyClassifierVerdict verdict); // Outpaints the image based on the mask and seed. Pass the same `seed` across // method calls to get identical result. The `image`, `mask`, and `result` are // byte arrays containing the encoded format of an image (e.g., PNG, JPEG). [MinVersion=6] Outpainting@4(array image, array mask, uint32 seed) => (MantisResult result); // Infers the segmentation mode (e.g., scribble or lasso) from a list of // touch events. [MinVersion=7] InferSegmentationMode@5(array gesture) => (SegmentationMode mode); };