how to divide a gif image into pieces
I want to divide a gif image with 4*4(16), 3*3(9),etc parts.
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.
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.
Thread #588196. Printed from Allegro.cc
Okay, first off, you're going to need an array of bitmaps. You can then store each tile to its individual bitmap.
for(int i=0; i<64; i++)
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:
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
So now the blue tile (tile 0 in the image) is stored in tile.
I'll warn you, I didn't compile any of that. So there may be some errors. But this is the theory behind it.