// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package mediapipe;

import "mediapipe/framework/calculator.proto";
import "mediapipe/util/color.proto";

// Options for the AnnotationOverlayCalculator.
message AnnotationOverlayCalculatorOptions {
  extend CalculatorOptions {
    optional AnnotationOverlayCalculatorOptions ext = 250607623;
  }

  // The canvas width and height in pixels, and the background color. These
  // options are used only if an input stream of ImageFrame isn't provided to
  // the renderer calculator. If an input stream of ImageFrame is provided, then
  // the calculator renders the annotations on top of the provided image, else a
  // canvas is created with the dimensions and background color specified in
  // these options and the annotations are rendered on top of this canvas.
  optional int32 canvas_width_px = 2 [default = 1920];
  optional int32 canvas_height_px = 3 [default = 1080];
  optional Color canvas_color = 4;

  // Whether text should be rendered upside down. When it's set to false, text
  // is rendered normally assuming the underlying image has its origin at the
  // top-left corner. Therefore, for images with the origin at the bottom-left
  // corner this should be set to true.
  optional bool flip_text_vertically = 5 [default = false];

  // Whether input stream IMAGE_GPU (OpenGL texture) has bottom-left or top-left
  // origin. (Historically, OpenGL uses bottom left origin, but most MediaPipe
  // examples expect textures to have top-left origin.)
  optional bool gpu_uses_top_left_origin = 6 [default = true];

  // Scale factor for intermediate image for GPU rendering.
  // This can be used to speed up annotation by drawing the annotation on an
  // intermediate image with a reduced scale, e.g. 0.5 (of the input image width
  // and height), before resizing and overlaying it on top of the input image.
  optional float gpu_scale_factor = 7 [default = 1.0];
}
