|
Create sub bitmap |
On1gh1r1
Member #16,028
July 2015
|
I need to create a sub bitmap from an existing bitmap, so i looked for it into allegro manual and i found al_create_sub_bitmap() function, but, as i have understood, that function just cut the parent image, 'cause they share the same drawing memory. So, it's my misunderstanding or to create a sub bitmap i must do this way: ALLEGRO_BITMAP *new_bitmap = al_create_bitmap(w, h); al_set_target_bitmap(new_bitmap); al_draw_bitmap_region(old_bitmap, x, y, w, h, 0, 0, 0);
|
StevenVI
Member #562
July 2000
|
On1gh1r1 said: I need to create a sub bitmap from an existing bitmap How do you define "sub bitmap"? If you mean you want to draw it onto another bitmap, then it looks like you're on the right track. (I'm rather clueless on Allegro 5's API, so I can't comment on specifics at the moment.) __________________________________________________ |
Edgar Reynaldo
Major Reynaldo
May 2007
|
What do you want to do with your 'sub' image? What is it for? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
On1gh1r1
Member #16,028
July 2015
|
Sry, my wrong. I need to create some new ALLEGRO_BITMAP variables that are a region of an existing ALLEGRO_BITMAP, but that also are independent from him. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Well, you have two choices. Clone the area, or create a sub bitmap. If you don't want the memory shared, clone the regions you want. If you don't mind if its shared, use a sub bitmap. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|