// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. using System; namespace FlaxEngine.GUI { /// /// Implementation of for . /// /// public sealed class TextureBrush : IBrush { /// /// The texture. /// [ExpandGroups, EditorOrder(0), Tooltip("The texture asset.")] public Texture Texture; /// /// 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 TextureBrush() { } /// /// Initializes a new instance of the struct. /// /// The texture. public TextureBrush(Texture texture) { Texture = texture; } /// public Vector2 Size => Texture?.Size ?? Vector2.Zero; /// public void Draw(Rectangle rect, Color color) { if (Filter == BrushFilter.Point) Render2D.DrawTexturePoint(Texture?.Texture, rect, color); else Render2D.DrawTexture(Texture, rect, color); } } }