using System; using System.Collections.Generic; using System.Drawing; using System.Text; namespace DirectUSB.Parameters { public class LCDContentsParameter : Parameter { #region Constructors / Teardown public LCDContentsParameter(short type, bool valid, byte[] data) : base(type, valid, data) { //Do nothing } #endregion #region Public Properties public Bitmap LCDContents { get { var ret = new Bitmap(96, 64); for (int i = 0; i < ret.Height; i++) { //For each row... for (int j = 0; j < ret.Width; j++) { //For each pixel/column...find out whether it's on or not int byteInRow = j / 8; int bitInByte = j % 8; byte dataByte = Data[i * 12 + (j / 8)]; bool on = ((dataByte >> (7 - bitInByte)) & 0x01) > 0? true : false; ret.SetPixel(j, i, on ? Color.Black : Color.White); } } return ret; } } #endregion } }