// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. namespace FlaxEngine.GUI { /// /// Implementation of for . /// /// public sealed class SpriteBrush : IBrush { /// /// The sprite. /// [ExpandGroups, EditorOrder(0), Tooltip("The sprite.")] public SpriteHandle Sprite; /// /// The texture sampling filter mode. /// [ExpandGroups, EditorOrder(1), Tooltip("The texture sampling filter mode.")] public BrushFilter Filter = BrushFilter.Linear; /// /// Initializes a new instance of the class. /// public SpriteBrush() { } /// /// Initializes a new instance of the struct. /// /// The sprite. public SpriteBrush(SpriteHandle sprite) { Sprite = sprite; } /// public Vector2 Size => Sprite.IsValid ? Sprite.Size : Vector2.Zero; /// public void Draw(Rectangle rect, Color color) { if (Filter == BrushFilter.Point) Render2D.DrawSpritePoint(Sprite, rect, color); else Render2D.DrawSprite(Sprite, rect, color); } } }