예제 #1
0
        public ArrayBasedCollection(IResizer resizer)
        {
            m_Resizer = resizer;
            int initialCapacity = m_Resizer.InitialCapacity;

            m_InnerArray = new T[initialCapacity];
            Count        = 0;
        }
 public LocalFileProvider(
     IHostingEnvironment env, 
     IHttpContextAccessor httpContextAccessor, 
     IResizer resizer,
     IFileSystemHelper fileSystemHelper)
 {
     this.env = env;
     this.httpContextAccessor = httpContextAccessor;
     this.resizer = resizer;
     this.fileSystemHelper = fileSystemHelper;
 }
 public LocalFileProvider(
     IHostingEnvironment env,
     IHttpContextAccessor httpContextAccessor,
     IResizer resizer,
     IFileSystemHelper fileSystemHelper)
 {
     this.env = env;
     this.httpContextAccessor = httpContextAccessor;
     this.resizer             = resizer;
     this.fileSystemHelper    = fileSystemHelper;
 }
예제 #4
0
        public BitmapSource GetFull(IResizer resizer, double scale = 1)
        {
            // need scale
            if (Math.Abs(scale - 1) > 0.0001)
            {
                return(GetPartial(resizer, new Int32Rect(0, 0, Width, Height), scale));
            }

            // no need scale
            var dst = Misc.AllocWriteableBitmap(source.Width, source.Height, source.Depth, source.Channel);

            Misc.CopyToWritableBitmap(dst, source.FullBitmap);
            dst.Freeze();
            return(dst);
        }
예제 #5
0
        public BitmapSource GetPartial(IResizer resizer, Int32Rect pos, double scale)
        {
            var src    = source.GetBitmap(pos);
            var result = Misc.AllocWriteableBitmap(
                (int)(pos.Width * scale), (int)(pos.Height * scale), src.Depth, src.Channel);

            result.Lock();

            var dst = Misc.BitmapOfWritableBitmap(result);

            resizer.Resize(src, dst);

            result.AddDirtyRect(new Int32Rect(0, 0, result.PixelWidth, result.PixelHeight));
            result.Unlock();

            result.Freeze();
            return(result);
        }
        public void Test_Add_Remove(IResizer resizeStrategy)
        {
            var initial = new[] {0, 1, 2, 3, 4, 5, 6, 7};
            var toRemove = new[] {2, 3, 5};
            var collection = new ArrayBasedCollection<int>(resizeStrategy);

            foreach (int element in initial)
            {
                collection.Add(element);
            }
            CollectionAssert.AreEquivalent(initial, collection.ToArray());

            foreach (int elementToRemove in toRemove)
            {
                collection.Remove(elementToRemove);
            }

            int[] expected = initial.Except(toRemove).ToArray();
            CollectionAssert.AreEquivalent(expected, collection.ToArray());

            collection.Clear();
            int[] emptyArray = Enumerable.Empty<int>().ToArray();
            CollectionAssert.AreEquivalent(emptyArray, collection.ToArray());
        }
예제 #7
0
        public void Test_Add_Remove(IResizer resizeStrategy)
        {
            var initial    = new[] { 0, 1, 2, 3, 4, 5, 6, 7 };
            var toRemove   = new[] { 2, 3, 5 };
            var collection = new ArrayBasedCollection <int>(resizeStrategy);

            foreach (int element in initial)
            {
                collection.Add(element);
            }
            CollectionAssert.AreEquivalent(initial, collection.ToArray());

            foreach (int elementToRemove in toRemove)
            {
                collection.Remove(elementToRemove);
            }

            int[] expected = initial.Except(toRemove).ToArray();
            CollectionAssert.AreEquivalent(expected, collection.ToArray());

            collection.Clear();
            int[] emptyArray = Enumerable.Empty <int>().ToArray();
            CollectionAssert.AreEquivalent(emptyArray, collection.ToArray());
        }
예제 #8
0
 public OptionFixedResizer(IResizer resizer, object option)
 {
     this.resizer = resizer;
     this.option  = option;
 }
예제 #9
0
 public AutoSwitchResizer(IResizer enlarge, IResizer shrink, IDoubler doubler = null)
 {
     enlargeResizer = enlarge;
     shrinkResizer  = shrink;
     this.doubler   = doubler;
 }
 public AzureBlobProvider(IOptions<AppSettings> appSettings, IResizer resizer)
 {
     this.appSettings = appSettings;
     this.resizer = resizer;
 }
 public AzureBlobProvider(IOptions <AppSettings> appSettings, IResizer resizer)
 {
     this.appSettings = appSettings;
     this.resizer     = resizer;
 }