public Bitmap ProvideForScreenRegion(ScreenRegion region, int width, int height, PixelFormat pixelFormat) { Bitmap bitmap; lock (_cache) { if (!_cache.TryGetValue(region, out bitmap)) { _cache[region] = bitmap = new Bitmap(width, height, pixelFormat); } } #if DEBUG if (BitmapIsDisposed(bitmap)) { throw new InvalidOperationException("Do not dispose cached Bitmaps!"); } #endif return(bitmap); }
public Bitmap ProvideForScreenRegion(ScreenRegion region, int width, int height, PixelFormat pixelFormat) { return(new Bitmap(width, height, pixelFormat)); }