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' : ' '); } } }
public void ComputeGlobalNet_WorksWell_Case2() { this.top = new MockupBitmapAccessor( new string[] { // 012345678 "", " XX XX", " XX XX", " XX XX", " XX XX", " XX XX", " XX XX", "" }); this.bottom = new MockupBitmapAccessor( new string[] { // 012345678 "", " XXXXXX", " XXXXXX", "", "", " XXXXXX", " XXXXXX", "" }); this.drill = new MockupBitmapAccessor( new string[] { // 012345678 "", " XX", " XX", "", "", " XX", " XX", "" }); CheckConnection(new string[] { "0:1,1:1", "0:2,1:2" }); Assert.IsTrue(false); }
/// <summary> /// Initializes a new instance of the <see cref="BitmapScanner"/> class, ready to scan the passed bitmap. /// </summary> /// <param name="bitmap">Bitmap to be scanned.</param> public BitmapScanner(IBitmapAccessor bitmap) { this.bitmap = bitmap; }