コード例 #1
0
ファイル: BitmapBuffer.cs プロジェクト: prepare/Tektosyne.NET
        /// <overloads>
        /// Makes the <see cref="BitmapBuffer"/> fully opaque.</overloads>
        /// <summary>
        /// Makes the <see cref="BitmapBuffer"/> fully opaque.</summary>
        /// <remarks>
        /// <b>MakeOpaque</b> replaces all <see cref="Pixels"/> elements with their <see
        /// cref="BitmapUtility.OpaquePbgra32"/> equivalents. Fully transparent pixels remain
        /// unchanged.</remarks>

        public void MakeOpaque()
        {
            for (int i = 0; i < _pixels.Length; i++)
            {
                _pixels[i] = BitmapUtility.OpaquePbgra32(_pixels[i]);
            }
        }
コード例 #2
0
ファイル: BitmapBuffer.cs プロジェクト: prepare/Tektosyne.NET
        /// <summary>
        /// Makes the specified rectangle in the <see cref="BitmapBuffer"/> fully opaque.</summary>
        /// <param name="bounds">
        /// The pixel rectangle in the <see cref="BitmapBuffer"/> to make opaque.</param>
        /// <remarks>
        /// <b>MakeOpaque</b> replaces all <see cref="Pixels"/> elements within the specified
        /// <paramref name="bounds"/> with their <see cref="BitmapUtility.OpaquePbgra32"/>
        /// equivalents. Fully transparent pixels remain unchanged. No coordinate checking is
        /// performed.</remarks>

        public void MakeOpaque(RectI bounds)
        {
            int offset = bounds.X + _size.Width * bounds.Y;

            for (int y = 0; y < bounds.Height; y++)
            {
                for (int x = 0; x < bounds.Width; x++)
                {
                    int i = offset + x;
                    _pixels[i] = BitmapUtility.OpaquePbgra32(_pixels[i]);
                }

                offset += _size.Width;
            }
        }
コード例 #3
0
 public void OpaquePbgra32()
 {
     Assert.AreEqual(0xFF203040, BitmapUtility.OpaquePbgra32(0xFF203040));
     Assert.AreEqual(0xFF1E2E3E, BitmapUtility.OpaquePbgra32(0x7F0F171F));
     Assert.AreEqual(0x00000000, BitmapUtility.OpaquePbgra32(0x00000000));
 }