public void Dispose() { if (isDisposed){ return; } if (pixelsHandle.IsAllocated){ pixelsHandle.Free(); } pixelsBase = null; isDisposed = true; GC.SuppressFinalize(this); }
public ColorPixelAccessor(IImageBase image) { if (image == null){ throw new ArgumentNullException(); } if (image.Width <= 0 || image.Height <= 0){ throw new ArgumentOutOfRangeException(); } Width = image.Width; Height = image.Height; pixelsHandle = GCHandle.Alloc(((ImageBase) image).Pixels, GCHandleType.Pinned); pixelsBase = (Color2*) pixelsHandle.AddrOfPinnedObject().ToPointer(); }
public ColorPixelAccessor(IImageBase image) { if (image == null) { throw new ArgumentNullException(); } if (image.Width <= 0 || image.Height <= 0) { throw new ArgumentOutOfRangeException(); } Width = image.Width; Height = image.Height; pixelsHandle = GCHandle.Alloc(((ImageBase)image).Pixels, GCHandleType.Pinned); pixelsBase = (Color2 *)pixelsHandle.AddrOfPinnedObject().ToPointer(); }
public void Dispose() { if (isDisposed) { return; } if (pixelsHandle.IsAllocated) { pixelsHandle.Free(); } pixelsBase = null; isDisposed = true; GC.SuppressFinalize(this); }