Example #1
0
        public void Resize(int width, int height)
        {
            if (_array != null)
            {
                Marshal.FreeHGlobal((IntPtr)_array);
            }

            _array  = (ColorPixel *)Marshal.AllocHGlobal(width * height * sizeof(ColorPixel));
            _width  = width;
            _height = height;
        }
Example #2
0
        public void Dispose()
        {
            if (!_disposed)
            {
                _disposed = true;

                if (_array != null)
                {
                    Marshal.FreeHGlobal((IntPtr)_array);
                    _array = null;
                }
            }
        }
Example #3
0
        public ColorGrabber(Texture texture, int width, int height)
        {
            if (Thread.CurrentThread != Program.MainThread)
            {
                throw new ThreadStateException();
            }

            OnWrite   = null;
            _texture  = texture;
            _width    = width;
            _height   = height;
            _array    = null;
            _disposed = false;

            Resize(width, height);
        }