예제 #1
0
        public void Gray16_FromScaledVector4()
        {
            // Arrange
            Gray16       gray     = default;
            const ushort expected = 32767;
            Vector4      scaled   = new Gray16(expected).ToScaledVector4();

            // Act
            gray.FromScaledVector4(scaled);
            ushort actual = gray.PackedValue;

            // Assert
            Assert.Equal(expected, actual);
        }
            public void ToGray16Bytes(int count)
            {
                Gray8[] source   = CreatePixelTestData(count);
                byte[]  expected = new byte[count * 2];
                Gray16  gray     = default;

                for (int i = 0; i < count; i++)
                {
                    int i2 = i * 2;
                    gray.FromScaledVector4(source[i].ToScaledVector4());
                    OctetBytes bytes = Unsafe.As <Gray16, OctetBytes>(ref gray);
                    expected[i2]     = bytes[0];
                    expected[i2 + 1] = bytes[1];
                }

                TestOperation(
                    source,
                    expected,
                    (s, d) => Operations.ToGray16Bytes(this.Configuration, s, d.GetSpan(), count)
                    );
            }