Aviso: cuando use imágenes truecolor, siempre debe ajustar el modo gráfico antes de cargar cualquier dato. De otro modo el formato de pixel (RGB o BGR) será desconocido, y el fichero podría ser convertido erróneamente.
BITMAP *load_bitmap(const char *filename, RGB *pal);
Carga un bitmap desde un fichero, devolviendo un puntero al bitmap y
almacenando los datos de la paleta en el lugar especificado, que debería
ser un array de 256 estructuras RGB. Es responsable de destruir el bitmap
cuando ya no lo necesite. Devuelve NULL si hubo errores. Por ahora esta
función soporta ficheros BMP, LBM, PCX y TGA, determinando el tipo por la
extensión del fichero. Si el fichero contiene una imagen truecolor, debe
ajustar el modo de vídeo o llamar set_color_conversion() antes de
cargarlo.
Relacionado con: load_bmp, load_lbm, load_pcx, load_tga, destroy_bitmap, save_bitmap, register_bitmap_file_type, set_color_depth, set_color_conversion.BITMAP *load_bmp(const char *filename, RGB *pal);
Relacionado con: load_bitmap.BITMAP *load_lbm(const char *filename, RGB *pal);
Relacionado con: load_bitmap.BITMAP *load_pcx(const char *filename, RGB *pal);
Relacionado con: load_bitmap.BITMAP *load_tga(const char *filename, RGB *pal);
Relacionado con: load_bitmap.int save_bitmap(const char *filename, BITMAP *bmp, const RGB *pal);
BITMAP *bmp;
PALETTE pal;
get_palette(pal);
bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
save_bitmap("pantalla.pcx", bmp, pal);
destroy_bitmap(bmp);
Relacionado con: save_bmp, save_pcx, save_tga, load_bitmap, register_bitmap_file_type.int save_bmp(const char *filename, BITMAP *bmp, RGB *pal);
Relacionado con: save_bitmap.int save_pcx(const char *filename, BITMAP *bmp, RGB *pal);
Relacionado con: save_bitmap.int save_tga(const char *filename, BITMAP *bmp, RGB *pal);
Relacionado con: save_bitmap.void register_bitmap_file_type(const char *ext, BITMAP *(*load)(const char *filename, RGB *pal), int (*save)(const char *filename, BITMAP *bmp, const RGB *pal));
Relacionado con: load_bitmap, save_bitmap.void set_color_conversion(int mode);
COLORCONV_NONE // desactiva las conversiones entre formatos
COLORCONV_8_TO_15 // expande 8 bits a 15 bits
COLORCONV_8_TO_16 // expande 8 bits a 16 bits
COLORCONV_8_TO_24 // expande 8 bits a 24 bits
COLORCONV_8_TO_32 // expande 8 bits a 32 bits
COLORCONV_15_TO_8 // reduce 15 bits a 8 bits
COLORCONV_15_TO_16 // expande 15 bits a 16 bits
COLORCONV_15_TO_24 // expande 15 bits a 24 bits
COLORCONV_15_TO_32 // expande 15 bits a 32 bits
COLORCONV_16_TO_8 // reduce 16 bits a 8 bits
COLORCONV_16_TO_15 // reduce 16 bits a 15 bits
COLORCONV_16_TO_24 // expande 16 bits a 24 bits
COLORCONV_16_TO_32 // expande 16 bits a 32 bits
COLORCONV_24_TO_8 // reduce 24 bits a 8 bits
COLORCONV_24_TO_15 // reduce 24 bits a 15 bits
COLORCONV_24_TO_16 // reduce 24 bits a 16 bits
COLORCONV_24_TO_32 // expande 24 bits a 32 bits
COLORCONV_32_TO_8 // reduce 32 bits en RGB a 8 bits
COLORCONV_32_TO_15 // reduce 32 bits en RGB a 15 bits
COLORCONV_32_TO_16 // reduce 32 bits en RGB a 16 bits
COLORCONV_32_TO_24 // reduce 32 bits en RGB a 24 bits
COLORCONV_32A_TO_8 // reduce 32 bits en RGBA a 8 bits
COLORCONV_32A_TO_15 // reduce 32 bits en RGBA a 15 bits
COLORCONV_32A_TO_16 // reduce 32 bits en RGBA a 16 bits
COLORCONV_32A_TO_24 // reduce 32 bits en RGBA a 24 bits
COLORCONV_DITHER_PAL // difumina al reducir a 8 bits
COLORCONV_DITHER_HI // difumina al reducir a hicolor
COLORCONV_KEEP_TRANS // mantiene la transparencia original
Por conveniencia, las siguientes macros pueden usarse para seleccionar
combinaciones comunes de los bits anteriores.
COLORCONV_EXPAND_256 // expande 256 colores a hi/truecolor
COLORCONV_REDUCE_TO_256 // reduce hi/truecolor a 256 colors
COLORCONV_EXPAND_15_TO_16 // expande hicolor de 15 bit a 16 bits
COLORCONV_REDUCE_16_TO_15 // reduce hicolor de 16 bits a 15 bits
COLORCONV_EXPAND_HI_TO_TRUE // expande 15/16 bits a 24/32 bits
COLORCONV_REDUCE_TRUE_TO_HI // reduce 24/32 bits a 15/16 bits
COLORCONV_24_EQUALS_32 // convierte entre 24 and 32 bits
COLORCONV_TOTAL // todo al formato actual
COLORCONV_PARTIAL // convierte 15 <-> 16 y 24 <-> 32
COLORCONV_MOST // todas excepto hi/truecolor <-> 256
Si activa el bit COLORCONV_DITHER, el difuminado se efectuará siempre
que los gráficos truecolor se conviertan a formato hicolor o modo con
paleta, incluyendo la función blit(), y cualquier rutina de conversión
automática que se ejecute cuando lea gráficos del disco. Esto puede
producir resultados visuales más atractivos, pero obviamente es mucho más
lento que una conversión directa.
Si intenta usar bitmaps convertidos con funciones como masked_blit() o draw_sprite(), debería especificar el bit COLORCONV_KEEP_TRANS. Se asegurará de que las áreas de máscara del bitmap antes y después de la conversión se mantendrán iguales, convirtiendo los colores transparentes de un modo a otro y ajustando aquellos colores que tras la conversión podrían ser reconvertidos en transparentes. Este bit afecta a cualquier llamada blit() entre formatos de pixel distintos y a cualquier conversión automática.
Relacionado con: makecol15_dither, set_color_depth, load_bitmap, load_datafile, fixup_datafile.