hi all,
I want to divide a gif image with 4*4(16), 3*3(9),etc parts.
Thank you
Be more specific.
I'm guessing you want tiles... I'm also having to assume you are already using a library that can load gifs into Allegro, and that you want to divide the image into diffrent parts inside of your program (as opposed to storing them as a file/files.
exactly ceagon
I used algif library and load_gif() fn. i want to divide that image into a no of pieces which on the whole constitute the original image.
Thank You
Okay, first off, you're going to need an array of bitmaps. You can then store each tile to its individual bitmap.
BITMAP *tile[64]; for(int i=0; i<64; i++) tile<i>=0;
Then you have to decide how you want to rip the segments of the image to the bitmaps themselves. I rip them in a row going left to right. Like this:
BITMAP *g=load_gif(); const int tile_width=16; const int tile_height=16; for(int i=0; i<g->w/tile_width; i++) //decides how many tiles it can squeeze out of the bitmap tile<i>=create_sub_bitmap(g,i*tile_width,0,tile_width,tile_height);
So now the blue tile (tile 0 in the image) is stored in tile[0].
I'll warn you, I didn't compile any of that. So there may be some errors. But this is the theory behind it.
thanks