My resize for pset4 finally worked and I can resize the small.bmp (that green square) properly. however it doesn't work for all the check50 requirements(except for compiling and running) and i don't know why. Here is my "peek" data for n = 3. Can anyone help me please? There is the results for comparing to the staff solution.
and here are my codes for padding
//resize header
bi_big.biWidth = bi.biWidth * n;
bi_big.biHeight = bi.biHeight * n;
// determine padding for scanlines
int old_padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) %4) % 4;
int padding = (4 - (bi_big.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
//resize header
bi_big.biSizeImage = (bi_big.biWidth + padding) * abs(bi_big.biHeight); //image+padding
bf_big.bfSize = bi_big.biSizeImage + 54;//biSize + headers
//resizing processes, unrelavent codes.......
//at the end of each scanline
for (int k = 0; k < padding; k++)
{
fputc(0x00, outptr);
}
if ( vert < n - 1)
{
fseek(inptr, -bi.biWidth * sizeof(RGBTRIPLE), SEEK_CUR);
//jump over old paddings without resizing
}
}
// skip over padding, if any
fseek(inptr, old_padding, SEEK_CUR);