/// <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]); } }
/// <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; } }
public void OpaquePbgra32() { Assert.AreEqual(0xFF203040, BitmapUtility.OpaquePbgra32(0xFF203040)); Assert.AreEqual(0xFF1E2E3E, BitmapUtility.OpaquePbgra32(0x7F0F171F)); Assert.AreEqual(0x00000000, BitmapUtility.OpaquePbgra32(0x00000000)); }