' it comes in already having the bitmap file open for binary as #f
...
MsgBox ("Begin Color Table Fix")
' PROCEDURE:
' 1) Get the BGR value of the background color
' 2) Get the BGR value of the color currently in table position 0
' 3) Put the BGR value of the background color into table position 0
' 4) Put the BGR value of the old position 0 color into the position that the background color came from
' 5) Change the raster data for the bg pixels from old color table position of bg color to "00"
' and change the raster data for the pixels that referenced the old position 0 color to that color's new color table position
MsgBox ("1")
Dim OrigBGColor
'MsgBox (BOB_p1)
Get #f, BOB_p1, BOB_FstByteColTblRef
'MsgBox ("First Pixel Color Table Reference: " & BOB_FstByteColTblRef)
If BOB_FstByteColTblRef > 0 Then
' 1) Get the BGR value of the background color
Dim decColTblRef_1
Dim decColTblRef_2
Dim decColTblRef_3
Dim decColTblRef_4
Dim decColTblRef_5
Dim decColTblRef_6
Dim bgColBlVal As Byte
Dim bgColGrVal As Byte
Dim bgColRdVal As Byte
decColTblRef_1 = (BOB_FstByteColTblRef * 4)
decColTblRef_2 = (decColTblRef_1 + 55)
decColTblRef_4 = (decColTblRef_2) ' position in byte array of blue val of bg color
decColTblRef_5 = (decColTblRef_2 + 1) ' position in byte array of green val of bg color
decColTblRef_6 = (decColTblRef_2 + 2) ' position in byte array of red val of bg color
Get #f, decColTblRef_4, bgColBlVal
Get #f, decColTblRef_5, bgColGrVal
Get #f, decColTblRef_6, bgColRdVal
MsgBox ("2")
'MsgBox ("the background color of the bitmap is: " & vbNewLine & "Blue = " & bgColBlVal & " Green = " & bgColGrVal & " Red = " & bgColRdVal)
'MsgBox ("BL: " & bgColBlVal & " GR: " & bgColGrVal & " RD: " & bgColRdVal)
' 2) Get the BGR value of the color currently in table position 0
Dim OrigPos0Bl As Byte
Dim OrigPos0Gr As Byte
Dim OrigPos0Rd As Byte
Get #f, 55, OrigPos0Bl
Get #f, 56, OrigPos0Gr
Get #f, 57, OrigPos0Rd
'MsgBox ("Bl: " & OrigPos0Bl & " Gr: " & OrigPos0Gr & " Rd: " & OrigPos0Rd)
' 3) Put the BGR value of the background color into table position 0
Put #f, 55, bgColBlVal
Put #f, 56, bgColGrVal
Put #f, 57, bgColRdVal
' 4) Put the BGR value of the old position 0 color into the position that the background color came from
' put it in whatever position the bgcol came (BOB_FstByteColTblRef) from
Put #f, decColTblRef_4, OrigPos0Bl
Put #f, decColTblRef_5, OrigPos0Gr
Put #f, decColTblRef_6, OrigPos0Rd
MsgBox ("3")
' 5) Change the raster data for the bg pixels from old color table position of bg color to "00"
' the parse is: if byte = BOB_FstByteColTblRef Then put byte = "ff"
' and...Change the raster data for the pixels that referenced the old position 0 color to that color's new color table position
Dim tfParInt
Dim tfParInt_1
Dim rByteValHex_1 As Byte
Dim rByteValHex2 As Byte
Dim tfBGColRefTemp As Byte
tfBGColRefTemp = 255
Dim tfOthColRefTemp As Byte
tfOthColRefTemp = 254
'MsgBox (BOB_FstByteColTblRef)
'MsgBox (BOB_p1)
For tfParInt = BOB_p1 To lngFileLen
rByteValHex_1 = argArray_raster(tfParInt)
'MsgBox (rByteValHex_1)
If rByteValHex_1 = BOB_FstByteColTblRef Then
'MsgBox ("here 1")
Put #f, tfParInt, tfBGColRefTemp
End If
If rByteValHex_1 = 0 Then
'MsgBox ("here 2")
Put #f, tfParInt, tfOthColRefTemp
End If
Next tfParInt
MsgBox ("4")
On Error Resume Next
For tfParInt_1 = 1 To lngFileLen
Dim tfParser
tfParser = (BOB + tfParInt_1)
'MsgBox ("tfParser = (should be 347)" & tfParser)
Get #f, tfParser, rByteValHex2
'MsgBox ("here 3, rByteValHex2 = (should be 255)" & rByteValHex2)
If rByteValHex2 = 255 Then
' MsgBox ("reached here 4")
Put #f, tfParser, 0
Else
If rByteValHex2 = 254 Then
' MsgBox ("reached here 5")
Put #f, tfParser, BOB_FstByteColTblRef
End If
End If
Next tfParInt_1
MsgBox ("5")
Else
MsgBox ("The background color is already in the first color table position")
End If
MsgBox ("End Color Table Fix")
...