// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
namespace FlaxEngine.GUI
{
///
/// Implementation of for .
///
///
public sealed class TextureBrush : IBrush
{
///
/// The texture.
///
[ExpandGroups, Tooltip("The texture asset.")]
public Texture Texture;
///
/// 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)
{
Render2D.DrawTexture(Texture, rect, color);
}
}
}