|
-
May 24th, 2005, 06:37 PM
#1
Thread Starter
Hyperactive Member
Loading BMP Files into QBASIC
I've done quite a few searches on the internet regarding the loading of a BMP file into QBASIC, but I've either found something quite big or something that does not tell me enough.
Is there any way to just simply load a BMP and let SCREEN 13 find the nearest matching colours?
-
May 26th, 2005, 09:05 AM
#2
Re: Loading BMP Files into QBASIC
EDIT: See the post following this one for a Quick Basic program that can load bitmaps.
The Quick Basic programs attached to this message can be used to load bitmaps. I think it shouldn't be too hard to figure out how the programs work and how the bitmap format works by studying the code.
Here is some information about the bitmap file format:
Code:
Bitmap header:
Location: Description:
1 2 byte file format indicator: "BM"
19 width in pixels
23 height in pixels
29 bits per pixel
(1 = monochrome, 4 = 16 colors, 8 = 256 colors, 24 = 24 bit color)
55 If the image uses 24 bit colors the actual image data will start at the location.
For all other color depths a palette is stored here. The palette is directly followed by the image data.
The palette contains a 4 byte (of which only the first 3 bytes are used) entry for each color index.
Each entry contains the RGB values for a specific color index.
Last edited by Peter Swinkels; Apr 8th, 2010 at 09:56 AM.
-
May 29th, 2005, 04:50 AM
#3
Re: Loading BMP Files into QBASIC
Here is a program that combines all four of the programs I attached to my previous message. It does a slightly better job at displaying the proper colors in 24 bit bitmaps and checks the file format and encoding. The code needs some cleaning up though and I might add support for RLE and OS/2 encoded bitmaps if I can figure out how these formats work.
Here is an updated table for the bitmap header format:
Code:
Bitmap header:
Location: Description:
1 2 byte file format indicator: "BM"
19 width in pixels
23 height in pixels
29 bits per pixel
(1 = monochrome, 4 = 16 colors, 8 = 256 colors, 24 = 24 bit color)
31 encoding
(255 = OS/2, 0 = RGB, 2 = RLE)
55 If the image uses 24 bit colors the actual image data will start at this location.
For all other color depths a palette is stored here. The palette is directly followed by the image data.
The palette contains a 4 byte entry (of which only the first 3 bytes are used) for each color index.
Each entry contains the RGB values for a specific color index.
You can also look at http://www.wotsit.org for information about the bitmap file format.
Last edited by Peter Swinkels; Nov 13th, 2014 at 12:39 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|