How would I compile a picture file into a program so that I can access it in the program, but it is part of the program?
How would I compile a picture file into a program so that I can access it in the program, but it is part of the program?
"If you tell the truth, you don't have to remember anything"
-Mark Twain
Umm...well the only thing I could think of would be to manually recreate it pixel by pixel in your code...if you study the file format for the picture you want to do this with, you may be able to read in all of the numbers in there, pour them out into a file, and pick over it translating it into a form that you can manually code into your program (put all of the points and color values into an array) and write an algorithm to paint it out...
but why on Earth would you want to do this?
Hey, you're from florida too? what part?
You can create bitmap resources in your resource file, these are then "compiled" into your program. There are some restrictions on the type of bitmaps you can use, can't remember off the top of my head, but I think you are limited to 256 colours for example. Look this up in the help.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
adrianxw- shouldn't that depend on his compiler?
>>> shouldn't that depend on his compiler?
Probably, (ISTR there is a limit in VC for example), - hence...
>>> Look this up in the help.
...if there is a limit, he may find it there, (although again, ISTR finding this out by experience rather than anything useful in the documentation).
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
Hey,
I think if your bmp is more than 256 colours then you can just import it rather that create it, this is what i did in msvc 6. Then if you try to view it in the resource editor it just says that it has exceeded 256 colours and cannot be opened but it will be compiled into the prog fine. So you can just import your bmp into your resource file and access it from there.
Hope thats of some help,
TNT
TNT
You Can Stop Me, But You Cant Stop Us All
If you're going to use a resource file to include the bitmap with your program, read the following:
http://www.winprog.org/tutorial/bitmaps.html
Good luck.
Ya, (TNT), I created an empty WIN32 program, so I don't have a resource file (.h or .cpp). How do I incorporate a file? I need to give it an ID.
"If you tell the truth, you don't have to remember anything"
-Mark Twain
Hey codemonkey,
Heres how to import your bmp into your resource to compile, and build into the exe.
In Msvc6 do:
1. File/New - Files Tab - Resource script, enter name and stuff.
2. Insert/Resource, you should get up a dialog.
3. Click Import, select all files and find your bmp and import it
Thats it , you can now assign an ID to it, it will be in bitmaps catogery in your resource file. Then just include resource.h in your app and compile and its built in.
Hope thats what you wanted.
TNT
TNT
You Can Stop Me, But You Cant Stop Us All
*A chorus sings as a lightbulb is turned on*
Thanks.
"If you tell the truth, you don't have to remember anything"
-Mark Twain