public Pen Update([NotNull] LineStyle style) { if (style == null) { throw new ArgumentNullException(nameof(style)); } lock (_lock) { if (_pens == null) { throw new ObjectDisposedException(nameof(GDIResourceManager)); } return(_pens.AddOrUpdate( style, k => CreatePen(k, false), (k, b) => { Resource <Pen> newPen = CreatePen(k, false); b.Dispose(); return newPen; }, false).Value); } }
public Bitmap Update([NotNull] IImage image) { if (image == null) { throw new ArgumentNullException(nameof(image)); } lock (_lock) { if (_bitmaps == null) { throw new ObjectDisposedException(nameof(GDIResourceManager)); } return(_bitmaps.AddOrUpdate( image, CreateBitmap, (k, b) => { Bitmap newBitmap = CreateBitmap(k); b.Dispose(); return newBitmap; }, false)); } }
public Brush Update([NotNull] IStyle style) { if (style == null) { throw new ArgumentNullException(nameof(style)); } lock (_lock) { if (_brushes == null) { throw new ObjectDisposedException(nameof(GDIResourceManager)); } return(_brushes.AddOrUpdate( style, k => CreateBrush(k, false), (k, b) => { Resource <Brush> newBrush = CreateBrush(k, false); b.Dispose(); return newBrush; }, false).Value); } }