// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
namespace FlaxEngine.GUI
{
///
/// Implementation of for .
///
///
public sealed class SpriteBrush : IBrush
{
///
/// The sprite.
///
[ExpandGroups]
public SpriteHandle Sprite;
///
/// 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)
{
Render2D.DrawSprite(Sprite, rect, color);
}
}
}