06-09-2006, 07:57 PM
I'm trying to code a bitmap routine by hand as opposed to using BLOAD, and it's giving me trouble.
infile.bmp is 20x20, but when I run the program it prints 1310720 and 65536. What am I doing wrong - do I have the bitmap_header TYPE incorrect?
Code:
type bitmap_header
bfType as ushort
bfsize as uinteger
bfReserved1 as ushort
bfReserved2 as ushort
bfOffBits as uinteger
biSize as uinteger
biWidth as uinteger
biHeight as uinteger
biPlanes as ushort
biBitCount as ushort
biCompression as uinteger
biSizeImage as uinteger
biXPelsPerMeter as uinteger
biYPelsPerMeter as uinteger
biClrUsed as uinteger
biClrImportant as uinteger
end type
type rgb_24bit
b as ubyte
g as ubyte
r as ubyte
end type
dim bmp_header as bitmap_header
dim image(bmp_header.biWidth*bmp_header.biHeight) as rgb_24bit
open "infile.bmp" for binary as #1
get #1,,bmp_header
get #1,,image()
close #1
print bmp_header.biWidth,bmp_header.biHeight
sleep
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
--------------------------------------
Freebasic is like QB, except it doesn't suck.