Пример #1
0
        public void ColorFromPbgra32()
        {
            Assert.AreEqual(Color.FromArgb(0xFF, 0x20, 0x30, 0x40),
                            BitmapUtility.ColorFromPbgra32(0xFF203040));

            Assert.AreEqual(Color.FromArgb(0x7F, 0x1E, 0x2E, 0x3E),
                            BitmapUtility.ColorFromPbgra32(0x7F0F171F));

            Assert.AreEqual(Color.FromArgb(0x00, 0x00, 0x00, 0x00),
                            BitmapUtility.ColorFromPbgra32(0x00000000));
        }
Пример #2
0
        /// <summary>
        /// Gets the <see cref="Color"/> of the specified pixel in the <see cref="BitmapBuffer"/>.
        /// </summary>
        /// <param name="x">
        /// The x-coordinate of the pixel whose <see cref="Color"/> to return.</param>
        /// <param name="y">
        /// The y-coordinate of the pixel whose <see cref="Color"/> to return.</param>
        /// <returns>
        /// The <see cref="Color"/> of the pixel at the specified location in the <see
        /// cref="BitmapBuffer"/>.</returns>
        /// <remarks>
        /// <b>GetPixel</b> returns the <see cref="Color"/> equivalent of the <see cref="Pixels"/>
        /// element at the specified <paramref name="x"/> and <paramref name="y"/> coordinates. No
        /// coordinate checking is performed.</remarks>

        public Color GetPixel(int x, int y)
        {
            uint value = _pixels[x + _size.Width * y];

            return(BitmapUtility.ColorFromPbgra32(value));
        }