/// <summary> /// Sets the pixel buffer in an unsafe manor this should not be used unless you know what its doing!!! /// </summary> /// <param name="pixels">The pixel buffer</param> /// <param name="ownedBuffer">if set to <c>true</c> then this instance ownes the buffer and thus should dispose of it afterwards.</param> private void SetPixelBufferUnsafe(Buffer2D <TPixel> pixels, bool ownedBuffer) { this.PixelBuffer = pixels; this.ownedBuffer = ownedBuffer; this.Width = pixels.Width; this.Height = pixels.Height; this.PixelSize = Unsafe.SizeOf <TPixel>(); this.RowStride = this.Width * this.PixelSize; }
public static unsafe void SizeOf <T>(int expected, T valueUnused) { // valueUnused is only present to enable Xunit to call the correct generic overload. Assert.Equal(expected, Unsafe.SizeOf <T>()); }