I have been struggling with resize (less). I can't seem to make sense of how to put the value of triple that is being read into an array (rewrite method) Any help will be appreciated
// iterate over infile's scanlines
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
{
//storing pixels in scanline here
RGBTRIPLE pixel[bi.biWidth * n];
// iterate over pixels in scanline
for (j = 0; j < bi.biWidth; j++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// save triple into an array of pixel
//TODO
}
// write line vertically n times
for (int vertical = 0; vertical < n; vertical++)
{
//write array to file
for (hor = 0; hor < outbi.biWidth; hor++)
{
fwrite(&pixel, sizeof(RGBTRIPLE), 1, outptr);
}
// write padding for outfile if neccessary
for (int pad = 0; pad < outpadding; pad++)
{
fputc(0x00, outptr);
}
}
// skip over padding, if any
fseek(inptr, infilepadding, SEEK_CUR);
}
// close infile
fclose(inptr);
// close outfile
fclose(outptr);
// success
return 0;
}