VB Code:
Dim I, J as Integer
Dim NextByte As Byte
Dim Writer As New IO.StreamWriter(IO.File.Create("c:\asdf\" & Letter & ".dat"), System.Text.Encoding.ASCII)
For I = 0 To 191
For J = 0 To 23
If BitBoard(J * 8, I) = True Then NextByte = NextByte Or 128 'flip bit 1
If BitBoard(J * 8 + 1, I) = True Then NextByte = NextByte Or 64 'flip bit 2
If BitBoard(J * 8 + 2, I) = True Then NextByte = NextByte Or 32 'flip bit 3
If BitBoard(J * 8 + 3, I) = True Then NextByte = NextByte Or 16 'flip bit 4
If BitBoard(J * 8 + 4, I) = True Then NextByte = NextByte Or 8 'flip bit 5
If BitBoard(J * 8 + 5, I) = True Then NextByte = NextByte Or 4 'flip bit 6
If BitBoard(J * 8 + 6, I) = True Then NextByte = NextByte Or 2 'flip bit 7
If BitBoard(J * 8 + 7, I) = True Then NextByte = NextByte Or 1 'flip bit 8
Writer.Write(Chr(NextByte))
NextByte = NextByte AndAlso 0
Next
Next
Writer.Close()
VB Code:
Dim i, J As Integer
Dim NextChar As Byte
Dim reader As New IO.StreamReader(IO.File.Open("c:\asdf\hello.dat", IO.FileMode.Open))
For i = 0 To 191
For J = 0 To 23
NextChar = reader.Read()
If NextChar And 128 Then SampleImage.SetPixel(J * 8, i, Color.Black)
If NextChar And 64 Then SampleImage.SetPixel(J * 8 + 1, i, Color.Black)
If NextChar And 32 Then SampleImage.SetPixel(J * 8 + 2, i, Color.Black)
If NextChar And 16 Then SampleImage.SetPixel(J * 8 + 3, i, Color.Black)
If NextChar And 8 Then SampleImage.SetPixel(J * 8 + 4, i, Color.Black)
If NextChar And 4 Then SampleImage.SetPixel(J * 8 + 5, i, Color.Black)
If NextChar And 2 Then SampleImage.SetPixel(J * 8 + 6, i, Color.Black)
If NextChar And 1 Then SampleImage.SetPixel(J * 8 + 7, i, Color.Black)
Next
NextChar = NextChar AndAlso 0
Next
SampleImage.SetPixel to flip make a pixel black....this is 1 bit color image storage.