blob: 072705f7fa1c95453af38a72067822c1da21f67a [file] [log] [blame]
// Copyright 2018 The Feed 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 search.now.ui.piet;
option optimize_for=LITE_RUNTIME;
option java_package = "com.google.search.now.ui.piet";
option java_outer_classname = "RoundedCornersProto";
option cc_enable_arenas = true;
// Rounded corners for Views, expressed as a bit mask. If a container view has
// rounded corners applied to it, then the contents of that view SHOULD also be
// cropped to fit within the rounded rectangle bounding box established by the
// container. Specifically, content within such a view SHOULD be cropped too,
// without having to explicitly specify rounded corners on the child content.
// Check [INTERNAL LINK] for any client-specific limitations that apply to the
// current version of the implementation.
message RoundedCorners {
// Represents the set of values for a bitmask to specify which corners should
// be rounded. Start indicates the left side for LTR settings, right side for
// RTL.
enum Corners {
// If unspecified, then all corners will be rounded.
CORNERS_UNSPECIFIED = 0;
// Indicates that the top starting corner should be rounded (top left for
// LTR, top right for RTL).
TOP_START = 0x1;
// Indicates that the top end corner should be rounded.
TOP_END = 0x2;
// Indicates that the bottom end corner should be rounded.
BOTTOM_END = 0x4;
// Indicates that the bottom starting corner should be rounded.
BOTTOM_START = 0x8;
}
// A bitmask representing which corners should be rounded. Bit values are
// defined by the `Corners` enum. If no corners are specified, then all
// corners will be rounded.
//
// NOTICE: having a rounded corner with a border only on one side is strongly
// discouraged as it leads to undefined and inconsistent behavior across
// platforms.
optional int32 bitmask = 1;
// The radius of the rounding applied to the specified corners, specified in
// DP. This value must be non-zero, otherwise it’s a no-op.
//
// This field is deprecated. Please use radius_options instead.
// radius and radius_dp have the same functionality. Both fields can be
// specified if there are concerns about users with old client versions that
// don't support the new field yet. If the client does recognize the new
// radius_options and the deprecated radius is specified as well, only
// radius_options will be used.
optional int32 radius = 2 [deprecated = true];
// The rounding radius applied to the corners specified in the bitmask. Value
// must be non-zero, otherwise it's a no-op. If the deprecated radius field is
// specified in addition to radius_options, only radius_options will be used.
//
// If the width or height of the element is less than the radius value, or the
// radii of adjacent corners add up to more than the element's width or
// height, the behavior is undefined. Piet will not crash, but the corners may
// look different on different platforms.
//
// One advantage of using a percentage is that, if accessibility settings
// change the text size and make an element grow or shrink, the radius will
// adjust as the size of the element changes.
oneof radius_options {
// The radius specified in dp.
uint32 radius_dp = 4;
// An integer value between 1 and 100. The corner radius is calculated as a
// percentage of the height of the element being rounded. It does not
// require the height to be explicitly specified on the element.
//
// For example:
// height = 100dp, width = 50dp, radius_percentage_of_height = 20%
// Actual radius (calculated by the client) = 20dp.
//
// Note that the value calculated from the height (i.e. 20dp) will be
// applied to both halves of any corners specified in the bitmask.
uint32 radius_percentage_of_height = 5;
// An integer value between 1 and 100. The corner radius is calculated as a
// percentage of the width of the element being rounded. It does not
// require the width to be explicitly specified on the element.
//
// For example:
// height = 100dp, width = 50dp, radius_percentage_of_width = 20%
// Actual radius (calculated by the client) = 10dp.
//
// Note that the value calculated from the width (i.e. 10dp) will be
// applied to both halves of any corners specified in the bitmask.
uint32 radius_percentage_of_width = 6;
}
// Flag to ask the host for a default radius. If the host does not return a
// radius, fall back to "radius_options". If this field is true and the host
// has provided a default radius, radius_options will be ignored.
optional bool use_host_radius_override = 3;
// Please use CL numbers you own for extension numbers.
extensions 10000 to max;
}