/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include #include #include #include #include #include #include namespace facebook::react { enum class RadialGradientShape { Circle, Ellipse }; struct RadialGradientSize { enum class SizeKeyword { ClosestSide, FarthestSide, ClosestCorner, FarthestCorner }; struct Dimensions { ValueUnit x; ValueUnit y; bool operator==(const Dimensions& other) const { return x == other.x && y == other.y; } bool operator!=(const Dimensions& other) const { return !(*this == other); } }; std::variant value; bool operator==(const RadialGradientSize& other) const { if (std::holds_alternative(value) && std::holds_alternative(other.value)) { return std::get(value) == std::get(other.value); } else if ( std::holds_alternative(value) && std::holds_alternative(other.value)) { return std::get(value) == std::get(other.value); } return false; } bool operator!=(const RadialGradientSize& other) const { return !(*this == other); } }; struct RadialGradientPosition { std::optional top; std::optional left; std::optional right; std::optional bottom; bool operator==(const RadialGradientPosition& other) const { return top == other.top && left == other.left && right == other.right && bottom == other.bottom; } bool operator!=(const RadialGradientPosition& other) const { return !(*this == other); } }; struct RadialGradient { RadialGradientShape shape; RadialGradientSize size; RadialGradientPosition position; std::vector colorStops; bool operator==(const RadialGradient& other) const { return shape == other.shape && size == other.size && position == other.position && colorStops == other.colorStops; } bool operator!=(const RadialGradient& other) const { return !(*this == other); } }; }; // namespace facebook::react