public void ToVector4_IsRgba32Compatible(byte luminance) { var original = new La16(luminance, luminance); Rgba32 rgba = default; original.ToRgba32(ref rgba); var la16Vector = original.ToVector4(); var rgbaVector = original.ToVector4(); Assert.Equal(la16Vector, rgbaVector, new ApproximateFloatComparer(1e-5f)); }
public void FromVector4_IsRgba32Compatible(byte luminance) { var original = new La16(luminance, luminance); Rgba32 rgba = default; original.ToRgba32(ref rgba); var rgbaVector = original.ToVector4(); La16 mirror = default; mirror.FromVector4(rgbaVector); Assert.Equal(original, mirror); }
public void La16_ToVector4(byte input) { // Arrange var gray = new La16(input, input); // Act var actual = gray.ToVector4(); // Assert float scaledInput = input / 255F; Assert.Equal(scaledInput, actual.X); Assert.Equal(scaledInput, actual.Y); Assert.Equal(scaledInput, actual.Z); Assert.Equal(scaledInput, actual.W); }