// Copyright (c) Wojciech Figat. All rights reserved. namespace FlaxEngine.GUI { /// /// Asset with that can be reused in different UI controls. /// /// /// public class UIBrushAsset { /// /// Brush object. /// public IBrush Brush; } /// /// Implementation of for frame displaying. /// /// /// public sealed class UIBrush : IBrush { /// /// The UI Brush asset to use. /// public JsonAssetReference Asset; /// /// Initializes a new instance of the class. /// public UIBrush() { } /// /// Initializes a new instance of the struct. /// /// The UI Brush asset to use. public UIBrush(JsonAssetReference asset) { Asset = asset; } /// /// Initializes a new instance of the struct. /// /// The UI Brush asset to use. public UIBrush(JsonAsset asset) { Asset = asset; } /// public Float2 Size { get { var asset = (UIBrushAsset)Asset.Asset?.Instance; if (asset != null && asset.Brush != null) return asset.Brush.Size; return Float2.Zero; } } /// public void Draw(Rectangle rect, Color color) { var asset = (UIBrushAsset)Asset.Asset?.Instance; if (asset != null && asset.Brush != null) asset.Brush.Draw(rect, color); } } }