Exemple #1
0
            public void Rgba32_ToLa16_IsInverseOf_La16_ToRgba32(byte luminance)
            {
                var original = new La16(luminance, luminance);

                Rgba32 rgba = default;

                original.ToRgba32(ref rgba);

                La16 mirror = default;

                mirror.FromRgba32(rgba);

                Assert.Equal(original, mirror);
            }
        public void La16_FromRgba32(byte rgb)
        {
            // Arrange
            La16 gray     = default;
            byte expected = ColorNumerics.Get8BitBT709Luminance(rgb, rgb, rgb);

            // Act
            gray.FromRgba32(new Rgba32(rgb, rgb, rgb));
            byte actual = gray.L;

            // Assert
            Assert.Equal(expected, actual);
            Assert.Equal(255, gray.A);
        }