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

option java_package = "com.google.mediapipe.formats.annotation.proto";
option java_outer_classname = "RasterizationProto";

// A Region can be represented in each frame as a set of scanlines
// (compressed RLE, similar to rasterization of polygons).
// For each scanline with y-coordinate y, we save (possibly multiple) intervals
// of occupied pixels represented as a pair [left_x, right_x].
message Rasterization {
  message Interval {
    required int32 y = 1;
    required int32 left_x = 2;
    required int32 right_x = 3;
  }

  // Intervals are always sorted by y-coordinate.
  // Therefore, a region occupies a set of scanlines ranging
  // from interval(0).y() to interval(interval_size() - 1)).y().
  // Note: In video, at some scanlines no interval might be present.
  repeated Interval interval = 1;
}
