Example #1
0
            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));
            }
Example #2
0
            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);
            }
Example #3
0
        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);
        }