-
@Himanshu40 @chandrakant100 @sabyasachi07 @HembramBeta777 @Tushar7-coder Please discuss more about padding and how used here // Determine padding for scanlines
size_t padding {(4 - (width * sizeof(RGBTRIPLE)) % 4) % 4}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The padding bytes are the bytes following the pixels of a scanline (A scan line is one line, or row, in a raster scanning pattern). Each scan line must end on a 4-byte boundary, so one, two, or three bytes of padding may follow each scan line. for example, A 24-bit bitmap with However, padding is the same for all the scanlines so it needs to calculate once. reference : Wikipedia and FileFormat |
Beta Was this translation helpful? Give feedback.
The padding bytes are the bytes following the pixels of a scanline (A scan line is one line, or row, in a raster scanning pattern). Each scan line must end on a 4-byte boundary, so one, two, or three bytes of padding may follow each scan line.
Padding bytes (not necessarily 0) must be appended to the end of the rows in order to bring up the length of the rows to a multiple of four bytes. When the pixel array is loaded into memory, each row must begin at a memory address that is a multiple of 4. This address/offset restriction is mandatory only for Pixel Arrays loaded in memory.
For file storage purposes, only the size of each row must be a multiple of 4 bytes while the file offset can be …