// Copyright 2024 Google LLC
//
// 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 = "proto3";
package designcompose.definition.element;
import "google/protobuf/empty.proto";
option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;
// Size encapsulates the dimensions of an element, expressed as width and height
// values. These values typically represent pixels or density-independent pixels
// (dp), allowing for consistent sizing across different screen densities.
message Size {
float width = 1;
float height = 2;
}
// Vector defines a two-dimensional geometric vector, consisting of x and y
// components. Vectors are fundamental for representing spatial relationships
// and performing geometric transformations within a definition.
message Vector {
float x = 1;
float y = 2;
}
// Rectangle: Rectangle represents a rectangular region within a design, defined
// by its position (x, y coordinates) and dimensions (width, height).
message Rectangle {
optional float x = 1;
optional float y = 2;
optional float width = 3;
optional float height = 4;
}
/** Dimension in Rust is an union-type enum, which are represented in proto by
`oneof` structures. `oneof` isn't a message type by itself, so in order to
re-use the Dimension oneof it needs to go into a `DimensionProto` message.
*/
message DimensionProto {
oneof Dimension {
google.protobuf.Empty undefined = 1;
google.protobuf.Empty auto = 2;
float points = 3;
float percent = 4;
}
}
/* The `Rect` type is generic/templated in Rust, which isn't supported in
* protobuf. Instead we will define individual messages for each type of
* `Rect` that we use.
*/
message DimensionRect {
DimensionProto start = 1;
DimensionProto end = 2;
DimensionProto top = 3;
DimensionProto bottom = 4;
}