/* * 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 #include #ifdef RN_SERIALIZABLE_STATE #include #endif 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); } #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; #endif }; std::variant value; bool operator==(const RadialGradientSize &other) const { return value == other.value; } bool operator!=(const RadialGradientSize &other) const { return !(*this == other); } #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; #endif }; 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); } #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; #endif }; 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); } #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; #endif #if RN_DEBUG_STRING_CONVERTIBLE void toString(std::stringstream &ss) const; #endif }; }; // namespace facebook::react