Search code examples
cassemblybitmapallegro

How to create a bitmap from assembly, using allegro?


My task is to generate fractal in C. The problem is that all computing must be done in x86 assembly, in a function defined by me.

I chose allegro5 library to do it. My question is:
Is there any possibility to get an address of allocated memory for bitmap by function?

ALLEGRO_BITMAP *al_create_bitmap(int w, int h)

Of course I mean bitmap, not ALLEGRO_BITMAP structure.
And will ALLEGRO_BITMAP structure work properly after coloring?
I read something that it shouldn't be modified by any other functions except this from documentation :)


Solution

  • al_lock_bitmap gives you an ALLEGRO_LOCKED_REGION which tells you the data address, the pitch, and stride of the locked region. You can edit the memory directly. Then when you are done, call al_unlock_bitmap to upload the changes.