// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. namespace FlaxEngine.GUI { /// /// Implementation of for linear color gradient (made of 2 color). /// /// public sealed class LinearGradientBrush : IBrush { /// /// The brush start color. /// [EditorOrder(0), ExpandGroups, Tooltip("The brush start color.")] public Color StartColor; /// /// The brush end color. /// [EditorOrder(1), Tooltip("The brush end color.")] public Color EndColor; /// /// Initializes a new instance of the class. /// public LinearGradientBrush() { StartColor = Color.White; EndColor = Color.Black; } /// /// Initializes a new instance of the struct. /// /// The start color. /// The end color. public LinearGradientBrush(Color startColor, Color endColor) { StartColor = startColor; EndColor = endColor; } /// public Float2 Size => Float2.One; /// public void Draw(Rectangle rect, Color color) { var startColor = StartColor * color; var endColor = EndColor * color; Render2D.FillRectangle(rect, startColor, startColor, endColor, endColor); } } }