You have mixed them a little in your head but we are here. :)
Firstly, the line
doesn't get a pixel, it just declares a variable, of type RGBTRIPLE with the name triple. It would be the same as
nothing less, nothing more.
All the information, is passed to triple, through fread().
fread() takes 4 arguments:
buffer - ...
I realise that this question is over a year old, however other people may still be having the issue so thought I would answer.
I have had exactly the same issue - for me, the problem was caused by being on Windows 10 and having altered the "customise display" setting "Change the size of text, apps, and other items" from the recommended 125% to 100%.
I have ...
You use bi.biWidth (in your case the output width at that point) both in
for (int j = 0; j < bi.biWidth; j++)
(found twice) and
fseek(inptr, (bi.biWidth * sizeof(RGBTRIPLE)) * -1, SEEK_CUR);
In both cases, you would have to use input width, not output width.
Same is true for the height, though it would cause a larger file, but no visible distortion ...
Have you tried the steps described in the problem statement's "Testing" chapter?
The total file size is part of the BITMAPFILEHEADER. As far as I know, there are a few other fields containing various size information, most of them are optional in case of a simple non-compressed image (we ...
It all has to do with padding and repositioning with fseek.
If the code isn't repositiioning correctly, the code won't be aligned with the beginning of a line of pixels. When that happens the padding gets used as if it were part of a pixel. Think about this. A red pixel looks like 00ff00. Now, say that the code is copying two pixels, but the file pointer ...
Your problem is with your fseek()s.
You should fseek() back to beginning of the current line each time you read all the pixels of this line. You should do this n times for each line.
You should fseek() at the beginning of the next line after the n-th time you print a line.
Also, when you want to fseek() backwards, the offset parameter should be negative. ...