Bitmap loading question

This is a discussion on Bitmap loading question within the C++ Programming forums, part of the General Programming Boards category; Well, right now I'm making a windows application where I need to load a bitmap to the window, I need ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    Bitmap loading question

    Well, right now I'm making a windows application where I need to load a bitmap to the window, I need to know when I create my bmp loader, to hold all the pixel data from the file(which should be stored in the first 52 bytes right?) and I send my program to others, will they need the bmp to see the picture in the program? If so, how do I make it so they dont?

    Edit:

    I know I dont need to make a bitmap loader, but I have me reasons why I want to >.>, mainly because I want to be able to make one if im not programming in win32 api.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    If you rely on an external file, like a BMP file, the end user will need that file.

    If you want to not rely on such a file, you would need to embed the file in your executable (maybe as a string).

    It's easier to just rely on your BMP.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    how?

    Ok, well can you please give me a description of how to do so? because if I knew it would make things more convenient. Or where to go so I can learn how to embed my bmp in my executable.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    If this is your file:
    Code:
    Hello, World!
    then you could put this into your program:
    Code:
    const char *filecontents = "Hello, World!\n";
    Of course, if your file contains weird chars you might have a string that ends up looking like this:
    Code:
    const char *stuff = "\044\744Hj_=\222";
    It would be better to rely on an external file.

    BTW, embedding something into your executable will increase the executable's size.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    ya

    It wont matter if it increases my executables file or not (currently its only 6kb and almost done)

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Well, will it matter if you rely on an external file?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Perhaps a BITMAP resource is appropriate here. http://msdn.microsoft.com/library/de...p_resource.asp

    >> hold all the pixel data from the file(which should be stored in the first 52 bytes right?)

    Well, the BITMAPINFO structure is 44 bytes. What were you referring too?

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    Referring to...

    I was referring to the header, where all the bitmap info is stored, which I think you just answered =P. thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmap extractor
    By Punnie in forum C++ Programming
    Replies: 2
    Last Post: 10-22-2005, 01:15 PM
  2. Loading BITMAP Resource
    By FWGaming in forum C++ Programming
    Replies: 1
    Last Post: 07-19-2005, 12:07 PM
  3. OpenGL Again, Loading Textures onto Quads
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 05-07-2005, 08:14 PM
  4. Problem with bitmap loading.
    By ZooTrigger1191 in forum Windows Programming
    Replies: 2
    Last Post: 02-20-2003, 01:41 PM
  5. Loading and Displaying Bitmap
    By Master_of_Error in forum C Programming
    Replies: 1
    Last Post: 02-02-2003, 12:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21