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; }
public void Dispose() { if (!_disposed) { _disposed = true; if (_array != null) { Marshal.FreeHGlobal((IntPtr)_array); _array = null; } } }
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); }