예제 #1
0
        private void Init(int width, int height, bool zeroFill)
        {
            _width  = width;
            _height = height;
            var len = width * height;

            _pixels = (ColorByte *)Marshal.AllocHGlobal(sizeof(ColorByte) * len);
            if (zeroFill)
            {
                new Span <ColorByte>(_pixels, len).Clear();
            }
        }
예제 #2
0
 private void Dispose(bool disposing)
 {
     Marshal.FreeHGlobal((IntPtr)_pixels);
     _pixels = null;
     _width  = 0;
     _height = 0;
     _token  = 0;
     if (disposing)
     {
         _token = _tokenFactory.CreateNonZeroToken();
         ChainInstancePool <DefaultImageSource> .ReturnInstanceFast(this);
     }
 }