/*
*/

#include"allegro.h"
#include"algbm.h"
#include"seal.h"

BITMAP *my_load_gbm(AL_CONST char *filename, RGB *pal){
 BITMAP *p;
 long cd=_color_depth;
 _color_depth=24; /* force loading to 24bit let fixup_loaded_bitmap handle dithering later */
 set_color_depth(24);
 p=load_gbm(filename,pal);
// fprintf(stderr,"gif/ppm loader %s -> %lx\n",filename,(unsigned long)(p->vtable->color_depth));
 set_color_depth(cd);
 return p;
}

lib_exportable

lib_begin ( void )
{
        if ( ap_process == AP_ALLOC ) { /* first call of library */
          AP_EXPORTLIB(); /* export table in gifsup.exp */

          register_bitmap_file_type("gif", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("tif", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("vid", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("pgm", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("ppm", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("iax", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("xbm", &my_load_gbm, &save_gbm);
          register_bitmap_file_type("pse", &my_load_gbm, &save_gbm);

        } else

        if ( ap_process == AP_INIT ) {

          AP_SETNUMOFCALLS(1); /* set max num of calls */

        } else

        if ( ap_process == AP_FREE ) { /* last call of library */
          register_bitmap_file_type("gif", NULL, NULL);
          register_bitmap_file_type("tif", NULL, NULL);
          register_bitmap_file_type("vid", NULL, NULL);
          register_bitmap_file_type("pgm", NULL, NULL);
          register_bitmap_file_type("ppm", NULL, NULL);
          register_bitmap_file_type("iax", NULL, NULL);
          register_bitmap_file_type("xbm", NULL, NULL);
          register_bitmap_file_type("pse", NULL, NULL);

        };

} lib_end;

