public static void FlushCache() { foreach (Bitmap Bmp in TextureCache.Values) { Bmp.Dispose(); } TextureCache.Clear(); }
/// <summary> /// 使用中のリソースをすべてクリーンアップします。 /// </summary> /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } Bmp.Dispose(); divisionTextBrush.Dispose(); base.Dispose(disposing); }
public void Resize(int width, int height) { lock (_resizeLock) { if (height > 0 && width > 0) { Bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb); } else { Bmp?.Dispose(); Bmp = null; } } }
public void Resize(Rectangle rect, bool setRect) { if (setRect) { Rect = rect; } CreateBoundRectangle(); if (Bmp != null && Rect.Width > 0 && Rect.Height > 0) { Bitmap bmp = Bmp.Resize(Rect.Width, Rect.Height); Bmp.Dispose(); Bmp = bmp; } }
/// <summary> /// 使用中のリソースをすべてクリーンアップします。 /// </summary> /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } if (Bmp != null) { Bmp.Dispose(); } if (DivisionTextBrush != null) { DivisionTextBrush.Dispose(); } base.Dispose(disposing); }
// Dispose(bool disposing) executes in two distinct scenarios. // If disposing equals true, the method has been called directly // or indirectly by a user's code. Managed and unmanaged resources // can be disposed. // If disposing equals false, the method has been called by the // runtime from inside the finalizer and you should not reference // other objects. Only unmanaged resources can be disposed. protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { if (Bmp != null) { Bmp.Dispose(); } } // Dispose managed resources. // Note disposing has been done. disposed = true; } }
public void Dispose() { Bmp.Dispose(); }