private void DisplayCurrentBitPatterns(BitMatrix currentBitPatterns) { using (var bitmapGraphics = Graphics.FromImage(_matrixBitmap)) { _characterToBitMapConverter.BuildBitMapPicture(currentBitPatterns, _onOffImageWidth, _onOffImageHeight, bitmapGraphics); } pictureBox.Invalidate(); }
public void BuildBitMapPicture(BitMatrix bitPatterns, int imageWidth, int imageHeight, Graphics bitmapGraphics) { for (var row = 0; row < bitPatterns.Count; ++row) { var bits = bitPatterns.GetBitsForRow(row); for (var col = 0; col < bits.Length; ++col) { bitmapGraphics.DrawImage(bits[col] ? _onBitmap : _offBitmap, col * imageWidth, row * imageHeight, imageWidth, imageHeight); } } }