Can anyone help point out what's wrong with my resize algorithm? I have researched and tried out many ways to do it and watched the walkthrough so many times. Here's the resizing part of my code and note that bi.biWidth is the resized width.
`
// temporary storage
RGBTRIPLE triple;
RGBTRIPLE *scanline = malloc(bi.biWidth * sizeof(RGBTRIPLE));
// iterate over infile's scanlines
for (int i = 0; i < abs(oldheight); i++)
{
//iterate over pixel line by line
for (int pixel = 0; pixel < oldwidth; pixel++)
{
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// store in array n times to resize horizontally
for (int c = 0; c < n; c++)
{
scanline[pixel + n] = triple;
}
}
// skip over padding, if any
fseek(inptr, oldpadding, SEEK_CUR);
//resize vertically
for (int v = 0; v < n; v++)
{
// iterate over pixels in array and write it n times
for (int j = 0; j < sizeof(scanline); j++)
{
fwrite(&scanline[j], sizeof(RGBTRIPLE), 1, outptr);
// add padding
for (int k = 0; k < newpadding; k++)
{
fputc(0x00, outptr);
}
}
}
}
`