Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » load image from external lib?

This thread is locked; no one can reply to it. rss feed Print
load image from external lib?
tom01 ms41
Member #15,370
October 2013

hi all:

how can I load image from external lib (ex. freeimage) in allegro 5?
or
how can I convert a buffer with rgba image data to ALLEGRO_BITMAP?

thanks

Elias
Member #358
May 2000

al_lock_bitmap with the format set to ABGR_LE is what I use. It expects data bytes for red, green, blue, alpha in that order.

--
"Either help out or stop whining" - Evert

Aikei_c
Member #14,871
January 2013
avatar

how can I convert a buffer with rgba image data to ALLEGRO_BITMAP?

Here is what I use:

ALLEGRO_FILE* f = al_open_memfile(buffer,size,"r");
ALLEGRO_BITMAP* btmp = al_load_bitmap_f(f,extension);
al_fclose(f);

EDIT: Nevermind, it won't work, I actually have whole file in memory, not just rgba image data.

Go to: