// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
namespace FlaxEngine.GUI
{
///
/// Implementation of for .
///
///
public sealed class GPUTextureBrush : IBrush
{
///
/// The GPU texture.
///
[HideInEditor]
public GPUTexture Texture;
///
/// The texture sampling filter mode.
///
[ExpandGroups, Tooltip("The texture sampling filter mode.")]
public BrushFilter Filter = BrushFilter.Linear;
///
/// Initializes a new instance of the class.
///
public GPUTextureBrush()
{
}
///
/// Initializes a new instance of the struct.
///
/// The GPU texture.
public GPUTextureBrush(GPUTexture texture)
{
Texture = texture;
}
///
public Float2 Size => Texture != null ? Texture.Size : Float2.Zero;
///
public void Draw(Rectangle rect, Color color)
{
if (Filter == BrushFilter.Point)
Render2D.DrawTexturePoint(Texture, rect, color);
else
Render2D.DrawTexture(Texture, rect, color);
}
}
}