Quote Originally Posted by VeNiX View Post
Isn't that a job for the header file to handle? essentially since I say that width is say 6 pixels, the renderer will be expecting a width that is a multiple of 4, so it expects 6 pixels plus 2 pixels of padding, after which it starts rendering the next row anyway... and since I'm already printing the pixels factor * factor of times it should work.
You are not printing pixels factor * factor times. That's why your algorithm doesn't work.
You essentially have:
Code:
        for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
        {
            //...
            for (int k = 0; k < bi.biWidth; k++)
                for (int l = 0; l < factor; l++)
                    fwrite(&buffer[k], sizeof(RGBTRIPLE), 1, outptr);
So horizontally you print each pixel of the original image 'factor' times, but not vertically.

Maybe you should take a simpler example.
Code:
int original[3][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
const int factor = 2;
int resized[3 * factor][3 * factor] = { 0 };
Copy the values from original to resized in the same way you would do it for an image. You can easily check your results by printing the matrix to the screen.
There are no bytes or padding to worry about here; just the basic algorithm that you need.