delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

    }
I always get the error message. Why would the image not be found?
Allegro does work. I can draw pictures with it.


I can not get Allegro to load any BMP images. Here is a section of test code. The picture is in the working directory:
BITMAP *my_pic;
    my_pic = load_bitmap("kirby.bmp", NULL);
    if(!my_pic)
    {
        allegro_message("ERROR lol");
        return EXIT_FAILURE;
    }
I always get the error message. Why would the image not be found?
Allegro does work. I can draw pictures with it.

TOP

Where is your pallet?
Code:
  1. BITMAP *load_bitmap(const char *filename, RGB *pal);
  2. Loads a bitmap from a file. The palette data will be stored in the second parameter, which should be an array of 256 RGB structures. At present this function supports BMP, LBM, PCX, and TGA files, determining the type from the file extension.
  3. If the file contains a truecolor image, you must set the video mode or call set_color_conversion() before loading it. In this case, if the destination color depth is 8-bit, the palette will be generated by calling generate_optimized_palette() on the bitmap; otherwise, the returned palette will be generated by calling generate_332_palette().
  4. The pal argument may be NULL. In this case, the palette data are simply not returned. Additionally, if the file is a truecolor image and the destination color depth is 8-bit, the color conversion process will use the current palette instead of generating an optimized one.
  5. Example:
  6.       BITMAP *bmp;
  7.       PALETTE palette;
  8.       ...
  9.       bmp = load_bitmap("image.pcx", palette);
  10.       if (!bmp)
  11.          abort_on_error("Couldn't load image.pcx!");
  12.       ...
  13.       destroy_bitmap(bmp);Return value: Returns a pointer to the bitmap or NULL on error. Remember that you are responsible for destroying the bitmap when you are finished with it to avoid memory leaks.
Copy Code

TOP

Is kirby.bmp in the same directory where you are testing your program?

TOP

Hi. Found out that the problem was that the BMP file was corrupted. That is why it would  not load. Thanks for taking a look at my question.
- Joe



    }
I always get the error message. Why would the image not be found?
Allegro does work. I can draw pictures with it.

TOP

Back Forum