// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

package components.feed.core.proto.ui.piet;

option optimize_for = LITE_RUNTIME;

option java_package = "org.chromium.components.feed.core.proto.ui.piet";
option java_outer_classname = "ShadowsProto";
option cc_enable_arenas = true;

// Defines a shadow for a given element. This message has sub-messages that
// correspond to different methods that define shadows. Each client might
// support a subset of the methodologies, will ignore the ones it does not
// support, and may have a priority order for which type is used when multiple
// shadow messages are defined (probably defaulting to the most descriptive
// shadow type supported by the platform).
// See [INTERNAL LINK]
message Shadow {
  // BoxShadow definition. Supported by the web and iOS clients.
  optional BoxShadow box_shadow = 1;

  // Simple elevation-based shadow. Supported by Android.
  optional ElevationShadow elevation_shadow = 2;
}

// Defines a box shadow, as described in the CSS spec:
// https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow.
message BoxShadow {
  // Defines the horizontal offset of the shadow.
  //  * A positive value puts the shadow on the right side of the box (does not
  //    flip in RTL presentation).
  //  * A negative value puts the shadow on the left side of the box.
  optional int32 offset_x = 1;

  // Defines the vertical offset of the shadow.
  //  * A positive value puts the shadow below the box.
  //  * A negative value puts the shadow above the box.
  optional int32 offset_y = 2;

  // The blur radius of the shadow. The higher the number, the more blurred the
  // shadow will be.
  optional int32 blur_radius = 3;

  // The spread radius of the shadow. A positive value increases the size of the
  // shadow, a negative value decreases the size of the shadow.
  // Not supported by iOS.
  optional int32 spread_radius = 4;

  // Defines whether the shadow should appear on the inside (is_inset == true),
  // or the outside (is_inset == false).
  // Not supported by iOS.
  optional bool is_inset = 5;

  // The color of the shadow.
  optional fixed32 color = 6;
}

// Defines a simple elevation-based shadow, as described in Material Design:
// https://developer.android.com/training/material/shadows-clipping
message ElevationShadow {
  // Elevation of the view in dp; higher elevation creates larger shadows.
  optional int32 elevation = 1;
}
