Read BMP File
Read BMP File
How Can I Read A BMP File And Set VRAM_A_LCD = BMP File ?
-
- Site Admin
- Posts: 2060
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Read BMP File
That really depends on why you want to do that.
For an image viewer application this is a reasonable approach but for most DS games/applications you should use grit to convert the image at compile time. There are a couple of examples showing this in the supplied sample code.
For an image viewer application this is a reasonable approach but for most DS games/applications you should use grit to convert the image at compile time. There are a couple of examples showing this in the supplied sample code.
Re: Read BMP File
I Only Want Read The Color Information(for example: x=0, y=1, color=30) and then set the VRAM_A_LCD on this coordinates the color.WinterMute wrote:That really depends on why you want to do that.
For an image viewer application this is a reasonable approach but for most DS games/applications you should use grit to convert the image at compile time. There are a couple of examples showing this in the supplied sample code.
Re: Read BMP File
converting the bmp file with grit makes it a lot easier to get the colors and putting them in vram.
Re: Read BMP File
I Know, But I Need To Load On Program Running(If The Player Press Select Loads the BMP File Saved in FAT)vuurrobin wrote:converting the bmp file with grit makes it a lot easier to get the colors and putting them in vram.
Re: Read BMP File
you can use grit to convert the image file to an *.bin file and load that from fat. still easier than converting it on the ds.
Re: Read BMP File
Just to finally clarify what the best approach would be, are any images going to be user provided or are you going to be including what the user can select?
If they can be user provided, then you'll need to research the bmp file format and header to know what bytes to read to determine size, bit depth, etc, etc... It's easy to get this information with a couple of google searches.
If you're providing them but still want to load from the filesystem, then vurrobin's suggestion of converting to binary first is the best way to go because you can pretty much read in the binary data and write it directly to VRAM without the worry of cracking the bmp file format.
If they can be user provided, then you'll need to research the bmp file format and header to know what bytes to read to determine size, bit depth, etc, etc... It's easy to get this information with a couple of google searches.
If you're providing them but still want to load from the filesystem, then vurrobin's suggestion of converting to binary first is the best way to go because you can pretty much read in the binary data and write it directly to VRAM without the worry of cracking the bmp file format.
Re: Read BMP File
I'm Creating A Simple Paint And The User Can Save Own's BMP's, But If You TurnOff or Clean The Screen Re-Load The Image And You Can Re-Edit it.Sylus101 wrote:Just to finally clarify what the best approach would be, are any images going to be user provided or are you going to be including what the user can select?
If they can be user provided, then you'll need to research the bmp file format and header to know what bytes to read to determine size, bit depth, etc, etc... It's easy to get this information with a couple of google searches.
If you're providing them but still want to load from the filesystem, then vurrobin's suggestion of converting to binary first is the best way to go because you can pretty much read in the binary data and write it directly to VRAM without the worry of cracking the bmp file format.
User Draws-Saves The Image-Turn Off The Console-Then Start The Application And Press A To Load The BMP What He/She Saved Before.
Re: Read BMP File
Yeah, basically dealing with user-content, which requires that you know the format that you are working with.
Once loaded into memory, the format can be whatever to your liking, but understand that in order for it to be shown on-screen, you must comply with the formats the NDS can use to display stuff. A simple way to set it up is to set the display to framebuffer mode, and VRAM_A bank to LCD, so that you can just copy a raw 256x192 15-bit bitmap into vram and display it, but depending on what other plans you have for it may require alternate methods to dealing with it.
Once loaded into memory, the format can be whatever to your liking, but understand that in order for it to be shown on-screen, you must comply with the formats the NDS can use to display stuff. A simple way to set it up is to set the display to framebuffer mode, and VRAM_A bank to LCD, so that you can just copy a raw 256x192 15-bit bitmap into vram and display it, but depending on what other plans you have for it may require alternate methods to dealing with it.
Re: Read BMP File
Discostew wrote:Yeah, basically dealing with user-content, which requires that you know the format that you are working with.
Once loaded into memory, the format can be whatever to your liking, but understand that in order for it to be shown on-screen, you must comply with the formats the NDS can use to display stuff. A simple way to set it up is to set the display to framebuffer mode, and VRAM_A bank to LCD, so that you can just copy a raw 256x192 15-bit bitmap into vram and display it, but depending on what other plans you have for it may require alternate methods to dealing with it.
Code: Select all
videoSetMode(MODE_FB0);
vramSetVBlankA(VRAM_A_LCD);
Who is online
Users browsing this forum: Bing [Bot] and 2 guests