Hey,
i have completely added VESA VBE to my OS.now i want to load BITMAP or PNG in it. someone give me the code either in C or ASM
how to display bmp or png files on screen
Re: how to display bmp or png files on screen
I can sell you some code to do this. How much money do you have?shashwatsh wrote:Hey,
i have completely added VESA VBE to my OS.now i want to load BITMAP or PNG in it. someone give me the code either in C or ASM
If you want free code you could try libpng.
If a trainstation is where trains stop, what is a workstation ?
Re: how to display bmp or png files on screen
You'll probably not get anyone to give you custom code for free, but we'll give you some tips.
First, BMP files are easy. They have a small header, and then a list of pixels in exactly the same order and format as your video card expects them. If your display format and your BMP format are the same, you can simply copy the pixel data directly to the screen buffer.
Any other format, however, will need to be converted to pixels before the image can be displayed.
This web site targets operating system development, but file formats are a little outside of the scope for this site, unfortunately. I am currently looking at MP3 files, and I'm having to find information elsewhere. I'm trying to find a similar site that describes different file formats, like this one: http://fileformats.wikia.com/wiki/File_ ... _Main_Page
First, BMP files are easy. They have a small header, and then a list of pixels in exactly the same order and format as your video card expects them. If your display format and your BMP format are the same, you can simply copy the pixel data directly to the screen buffer.
Any other format, however, will need to be converted to pixels before the image can be displayed.
This web site targets operating system development, but file formats are a little outside of the scope for this site, unfortunately. I am currently looking at MP3 files, and I'm having to find information elsewhere. I'm trying to find a similar site that describes different file formats, like this one: http://fileformats.wikia.com/wiki/File_ ... _Main_Page
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: how to display bmp or png files on screen
You'll find VESA and image loading examples targeted for DOS and DJGPP/Watcom/Turbo C++/Borland C++/NASM. Also for HTML5, which are easier to understand and write for most people. You can use DOSBox and a recent Firefox/Chrome version (if you implement them in JavaScript) to work on them.
Here is some good information and code examples that show how to use VESA to load bitmaps (640x480x256 colors):
http://www.retro-games.co.uk/downloads/progvesa.htm
And see this one, which is the easiest example I've found about loading bitmaps (640x480x256 colors, but for other resolutions it's basically the same, additionally to adjusting the color resolution):
http://www.retro-games.co.uk/downloads/ex11.zip
________________________________________________
Also, the books Compressed Image File Formats by John Miano and Encyclopedia of Graphics File Formats, Second Edition by Murray and Vanryper, from O'Reilly will help you master those formats much faster. You can find them on the Internet and from Amazon/eBay. Make sure to get them with their CD's because that's where they contain all the valuable image, code and documentation resources.
CompressedImageFileFormatsJohnMiano.iso
Compressed-Image-File-Formats.pdf
EGFF2.iso (CD-ROM, Encyclopedia of Graphics File Formats Second Edition)
Book, Encyclopedia of Graphics File Formats Second Edition
Here you can also see an online GIF viewer codec I wrote in JavaScript/HTML5 Canvas which is capable to decompress the vast majority of GIF LZW streams, and show GIFs with one or more image animation frames, its palettes (ald also convert to grayscale nicely):
>> Online GIF Explainer and Viewer <<
These are also the file formats that can be visualized, in increasingly difficult order:
- BMP
- PCX
- GIF (they can also display animations, even with movie-like quality, look at cinemagraphs)
- PNG
- JPG
- MJPG (to make Internet streaming of webcams, desktops, etc.)
Here is some good information and code examples that show how to use VESA to load bitmaps (640x480x256 colors):
http://www.retro-games.co.uk/downloads/progvesa.htm
And see this one, which is the easiest example I've found about loading bitmaps (640x480x256 colors, but for other resolutions it's basically the same, additionally to adjusting the color resolution):
http://www.retro-games.co.uk/downloads/ex11.zip
________________________________________________
Also, the books Compressed Image File Formats by John Miano and Encyclopedia of Graphics File Formats, Second Edition by Murray and Vanryper, from O'Reilly will help you master those formats much faster. You can find them on the Internet and from Amazon/eBay. Make sure to get them with their CD's because that's where they contain all the valuable image, code and documentation resources.
CompressedImageFileFormatsJohnMiano.iso
Compressed-Image-File-Formats.pdf
EGFF2.iso (CD-ROM, Encyclopedia of Graphics File Formats Second Edition)
Book, Encyclopedia of Graphics File Formats Second Edition
Here you can also see an online GIF viewer codec I wrote in JavaScript/HTML5 Canvas which is capable to decompress the vast majority of GIF LZW streams, and show GIFs with one or more image animation frames, its palettes (ald also convert to grayscale nicely):
>> Online GIF Explainer and Viewer <<
These are also the file formats that can be visualized, in increasingly difficult order:
- BMP
- PCX
- GIF (they can also display animations, even with movie-like quality, look at cinemagraphs)
- PNG
- JPG
- MJPG (to make Internet streaming of webcams, desktops, etc.)
Last edited by ~ on Tue Jul 26, 2016 11:04 am, edited 21 times in total.
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: how to display bmp or png files on screen
Take a look at specifically decode_bmp24 and blit_buffer.
decode_bmp24 decodes a bitmap and makes a raw 32-bit pixel buffer that can be memcpy'd to the screen. blit_buffer does the latter; but it also works in 24-bit and 16-bit video modes, transparently to the user.
BTW, if I were you, I'd look at the documentation. "BMP/PNG file format" in Google will get you good results.
decode_bmp24 decodes a bitmap and makes a raw 32-bit pixel buffer that can be memcpy'd to the screen. blit_buffer does the latter; but it also works in 24-bit and 16-bit video modes, transparently to the user.
BTW, if I were you, I'd look at the documentation. "BMP/PNG file format" in Google will get you good results.
- Attachments
-
- gdi.asm
- (27.72 KiB) Downloaded 110 times
You know your OS is advanced when you stop using the Intel programming guide as a reference.