flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Showing a bmp in 32 bit mode

Author
Thread Post new topic Reply to topic
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
I was wondering which way would be easier to show a bmp in 32 bit mode.. to "import it directly" or to use a seperate program and translate it into the db code (BINTODB).. i would although prefer the import db directly a lot.. but i have no idea how you would do that, i have some "boot image" code that imports it directly, but that is 16 bit, would there be much of a difference? and if anyone can help, it is highly needed and appreciated, its for a project im working on, thanks everyone!









Redragon
Post 13 Jun 2005, 17:04
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
What eaxtly do you mean by "import it directly"

.BMP files have a format and the description of this format can be found on the internet.

IF you can read files into memory THEN you can decode the BMP file structure (that is pretty simple) and paint the bitmap/pixels on screen.
Post 13 Jun 2005, 23:49
View user's profile Send private message Visit poster's website Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
what i mean is, i think what your talking about, you create the bitmap file, then define the code to "import it directly" which is what you were saying about loading it into memory, then decoding the structure and painting it into memory.
Post 14 Jun 2005, 11:32
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Dex4u's simple guide to displaying a 24bit BMP, first we will start with a 24bit bmp because they are simpler than 8bit bmp.
First thing at the start of the image is a header of about 54byte with info on things like:
B M
FileSize
OffsetBits
SizeHeader
Width:
Height:
Planes
BitCount
Compression
NumPaddedBytes

The first thing you will notice is "B" "M" , as all bitmap files have two bytes with 'B' and 'M' at the start of the file, so we know its a BMP image file.
Now for our demo lets say we know all the details of size etc.
So we will jump over the header to where the image is, now the image is stored in a RGB
format so we have 1 red byte, 1 green byte, and 1 blue byte, so each pixel is 3 bytes in size
(or 24bits) so all you need do to display them is place them to a off screen buffer and then from a offscreen buff to screen.

Now if it was only that simple , but we are programmers (asm programmer at that), so we know it is not going to be Crying or Very sad.

So here some of the things to watch out for, first the image is stored up side down and second if you useing vesa some use 24bits and some use 32bits, so you need to test what is in "BitsPerPixel" in the vesa info if its 24bits you can put it in memory as it is, but if its 32bits and most are now, you need to add a byte to turn RGB to XRGB the X is just a byte of 0's, but it is needed to pad the 24bpp to 32bpp.

And as a image format it does not come any easer that 24bit BMP, now if you want to decompress and display a jpeg thats when things start geting hard Wink .
Post 15 Jun 2005, 02:25
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
Redragon wrote:
or to use a seperate program and translate it into the db code (BINTODB)..
Redragon

No need to do that ,you can include a file in the program with 'incbin' directive.
Post 15 Jun 2005, 13:22
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.