private void AssertAllSet(int width, int height, IBitmapAccessor accessor) { Assert.AreEqual(width, accessor.Width); Assert.AreEqual(height, accessor.Height); for (int x = 0; x < width; x++) { for (int y=0; y<height; y++) { Assert.IsTrue(accessor.PixelAt(x,y)); } } }
/// <summary> /// Initializes a new instance of the <see cref="CharacterBitmapGenerator"/> class. /// The bitmap has a bit set for any set bit of the passed bitmap. /// </summary> /// <param name="bitmapAccessor">Interface to access the passed bitmap. </param> public CharacterBitmapGenerator(IBitmapAccessor bitmapAccessor) : base(bitmapAccessor.Width, bitmapAccessor.Height) { this.scanlines = new StringBuilder[this.Height]; for (int y = 0; y < this.Height; y++) { this.scanlines[y] = new StringBuilder(); for (int x = 0; x < this.Width; x++) { this.scanlines[y].Append(bitmapAccessor.PixelAt(x, y) ? 'X' : ' '); } } }