// 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 "definition/element/path.proto";
import "definition/element/variable.proto";
option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;
// Represents the geometric shape of a visual element, such as a rectangle,
// ellipse, or a custom path. It determines the boundaries of the element and
// influences how it is rendered and interacted with within a design.
message ViewShape {
// Defines the appearance of the stroke's end points (e.g., round, square).
enum StrokeCap {
STROKE_CAP_UNSPECIFIED = 0;
STROKE_CAP_NONE = 1;
STROKE_CAP_ROUND = 2;
STROKE_CAP_SQUARE = 3;
STROKE_CAP_LINE_ARROW = 4;
STROKE_CAP_TRIANGLE_ARROW = 5;
STROKE_CAP_CIRCLE_FILLED = 6;
STROKE_CAP_DIAMOND_FILLED = 7; // Not supported
}
// A container for other objects. Equivalent to a Compose Box or a Figma Frame
message Box {
bool is_mask = 1;
}
// A rounded rectangle
message RoundRect {
// Should have exactly four corners
repeated NumOrVar corner_radii = 1;
float corner_smoothing = 2;
bool is_mask = 3;
}
// A vector path
message VectorPath {
repeated Path paths = 1;
repeated Path strokes = 2;
StrokeCap stroke_cap = 3;
bool is_mask = 4;
}
// Represents a complex arc shape within a design.
message VectorArc {
// The outer path defining the overall shape of the arc.
repeated Path paths = 1;
// An optional inner path used for creating an outline or stroke effect.
repeated Path strokes = 2;
StrokeCap stroke_cap = 3;
float start_angle_degrees = 4;
float sweep_angle_degrees = 5;
float inner_radius = 6;
float corner_radius = 7;
bool is_mask = 8;
}
// A shape defined by multiple paths, with potentially rounded corners
message VectorRect {
repeated Path paths = 1;
repeated Path strokes = 2;
repeated NumOrVar corner_radii = 3; // Exactly 4
bool is_mask = 4;
}
oneof shape {
Box rect = 1;
RoundRect round_rect = 2;
VectorPath path = 3;
VectorArc arc = 4;
VectorRect vector_rect = 5;
}
}