internal static void Dispose() { _uiTextureRegionAtlas = null; _uiStylesheet = null; Stylesheet.Current = null; if (_assetManager != null) { _assetManager.ClearCache(); _assetManager = null; } _whiteRegion = null; if (_white != null) { _white.Dispose(); _white = null; } #if !STRIDE if (_uiRasterizerState != null) { _uiRasterizerState.Dispose(); _uiRasterizerState = null; } #endif }
public TextureRegion(Texture2D texture, Rectangle bounds) { if (texture == null) { throw new ArgumentNullException("texture"); } _texture = texture; _bounds = bounds; }
public TextureRegion(TextureRegion region, Rectangle bounds) { if (region == null) { throw new ArgumentNullException("region"); } _texture = region.Texture; bounds.Offset(region.Bounds.Location); _bounds = bounds; }
internal static void Dispose() { _uiTextureRegionAtlas = null; _uiStylesheet = null; Stylesheet.Current = null; if (_assetManager != null) { _assetManager.ClearCache(); _assetManager = null; } _whiteRegion = null; _whiteTexture = null; }
/// <summary> /// Covers the whole texture /// </summary> /// <param name="texture"></param> public TextureRegion(Texture2D texture) : this(texture, new Rectangle(0, 0, texture.Width, texture.Height)) { }
public NinePatchRegion(Texture2D texture, Rectangle bounds, Thickness info) : base(texture, bounds) { _info = info; var centerWidth = bounds.Width - info.Left - info.Right; var centerHeight = bounds.Height - info.Top - info.Bottom; var y = bounds.Y; if (info.Top > 0) { if (info.Left > 0) { _topLeft = new TextureRegion(texture, new Rectangle(bounds.X, y, info.Left, info.Top)); } if (centerWidth > 0) { _topCenter = new TextureRegion(texture, new Rectangle(bounds.X + info.Left, y, centerWidth, info.Top)); } if (info.Right > 0) { _topRight = new TextureRegion(texture, new Rectangle(bounds.X + info.Left + centerWidth, y, info.Right, info.Top)); } } y += info.Top; if (centerHeight > 0) { if (info.Left > 0) { _centerLeft = new TextureRegion(texture, new Rectangle(bounds.X, y, info.Left, centerHeight)); } if (centerWidth > 0) { _center = new TextureRegion(texture, new Rectangle(bounds.X + info.Left, y, centerWidth, centerHeight)); } if (info.Right > 0) { _centerRight = new TextureRegion(texture, new Rectangle(bounds.X + info.Left + centerWidth, y, info.Right, centerHeight)); } } y += centerHeight; if (info.Bottom > 0) { if (info.Left > 0) { _bottomLeft = new TextureRegion(texture, new Rectangle(bounds.X, y, info.Left, info.Bottom)); } if (centerWidth > 0) { _bottomCenter = new TextureRegion(texture, new Rectangle(bounds.X + info.Left, y, centerWidth, info.Bottom)); } if (info.Right > 0) { _bottomRight = new TextureRegion(texture, new Rectangle(bounds.X + info.Left + centerWidth, y, info.Right, info.Bottom)); } } }