I finally got resize to work, but I have a few questions to help understand the code. First, the following line was breaking my code and took me forever to figure out:
bi.biSizeImage = abs(bi.biHeight) * (sizeof(RGBTRIPLE) * bi.biWidth + sizeof(padding));
sizeof() on padding fixed the code. I put
sizeof as a "safety" assuming padding was one byte (and thus
sizeof(padding) should also be one byte?). So I'm confused why
bi.biSizeImage = abs(bi.biHeight) * (sizeof(RGBTRIPLE) * bi.biWidth + padding); produces a different result.
My second question is what is the purpose of the following line:
// temporary storage RGBTRIPLE triple;
I kept it in there because it is in copy.c, and I assumed removing it wasn't a great idea but never truly understood that lines purpose.
Any help would be greatly appreciated.