Bitmap tile extracting?

Hey all, i'm new to this site so bare with me.

My goal is to create a function or class were, it takes a bitmap (ex. 640). This image is made up of a bunch of 32 by 32 images. I want my function to look at the bitmap, say create tiles on that image and creates or sets that image to a variable, something that is assessable.

ex..

o|x|o
o|o|o
o|o|o

the x represents (2,1) and the x is 32/32 and the o is also 32/32.

i have A LOT of these images like this, so i don't want to copy and paste as new. This function will REALLY help!!!

Any information towards this goal would be greatly appreciated!
Last edited on
Well, just create new bitmaps and copy the relevant pixels from the source bitmap.
What's the problem?

Roughly like this:
1
2
3
4
5
6
7
8
Bitmap createBitmapPart(const Bitmap& source,const Area& area)
{
  Bitmap part(area.width(),area.height());
  for (int y=0;y<area.height();y++)
      for (int x=0;x<area.width();x++)
          part.setPixel(x,y,source.getPixel(x+area.left,y+area.top));
  return part;
}


The exact functions depend on the classes/libraries you use, obviously.
Last edited on
Okay cool, I'll try that thank you
Topic archived. No new replies allowed.