I basically call this image resize method: "brute sizing" or "image scaling"
size calculation:
Original image size: 3 x 2 pixels (total of 6 pixels)
if you scale the height by 2 and the width by 2
Final image size: 6 x 4 pixels (total of 24 pixels)
Implementation:
here is an example:
lets say: AA=3, AB=2, AC=6 and BA=6, BB=4, BC=24 and scaleX=2, scaleY=2
int ptotal = AC; //or = AA * AB
for (pcount = 0; pcount < ptotal; ++pcount)
{
img_x = (pcount%(AA))*scaleX;
if ((pcount%(scaleX))==0)
img_y += scaleY;
set_rect_BMP(bmp,img_x,img_y,scaleX,scaleY,r,g,b);
}
int set_rect_BMP(BMP* bmp, int x, int y, int w, int h, int r, int g, int b) {
int i, j;
for (i = y; i < h+y; ++i)
{
for (j = x; j < w+x; ++j)
{
BMP_SetPixelRGB( bmp, j, i, r, g, b );
//BMP_SetPixelRGB( bmp, the x coord, the y coord, red, green, blue );
}
}
}
Diagram of the algorithm:
further explanation will be given if needed ;) see more on wikipedia here: http://en.wikipedia.org/wiki/Image_scaling