Code:
Type BitmapFileHeader
fType As String * 2
fSize As Long
reserve As Integer
reserve2 As Integer
fOffset As Long
End Type
Type BitmapInfoHeader
iSize As Long
iwidth As Long
iheight As Long
iPlanes As Integer
iBitCount As Integer
iCompression As Long
iSizeImage As Long
iXPels As Long
iYPels As Long
iUsedClr As Long
iImptntClr As Long
End Type
Type RGBQuad
b As String * 1
g As String * 1
r As String * 1
p As String * 1
End Type
Const tilesize% = 16
Const xtiles% = 14
Const ytiles% = 7
Dim fileheader As BitmapFileHeader
Dim infoheader As BitmapInfoHeader
Dim colors(255) As RGBQuad
Dim colortable&(255)
'**********
Screen 13
Open "pics\n_grass1.bmp" For Binary As #1
Get #1, , fileheader
GET #1, , infoheader
lineofbmp$ = Space$(infoheader.iwidth)
For snatchcolor% = 0 To 255
Get #1, , colors(snatchcolor%)
colortable&(snatchcolor%) = (((ASC(colors(snatchcolor%).b) \ 4) * 65536) + ((ASC(colors(snatchcolor%).g) \ 4) * 256&) + (ASC(colors(snatchcolor%).r) \ 4))
Next
Palette Using colortable&
DEF SEG = &HA000
For y% = infoheader.iheight - 1 To 0 Step -1
GET #1, , lineofbmp$
For x% = 0 TO infoheader.iwidth - 1
Poke y% * 320& + x%, Asc(Mid$(lineofbmp$, x% + 1, 1))
Next
Next
Close
Def Seg
the image data is stored in a .bmp upside-down, so youll have to figure out the logic to do this
oh, to load a bmp into an array in fb you ask? (lol)
dim holdbmp((bmpx * bmpy) \ 2 + 2)
bload "whatever.bmp", holdbmp(0)
i know, i know. hater. ;p;p;p;p;p