Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // storage of bytes-to-write
- RGBTRIPLE* line = malloc(bi.biWidth * sizeof(RGBTRIPLE));
- // iterate over infile's scanlines
- for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight / resize; i++)
- {
- // iterate over pixels in scanline
- for (int j = 0; j < bi.biWidth / resize; j++)
- {
- // read RGB triple from infile
- // storage of bytes read
- RGBTRIPLE* pixel = malloc(sizeof(RGBTRIPLE));
- fread(pixel, sizeof(RGBTRIPLE), 1, inptr);
- fseek(inptr, padding, SEEK_CUR);
- //copying bytes read (stored in *pixel) to bytes-to-write (stored in *line)
- for (int k = 0; k < resize; k++)
- {
- //memcpy(line + (j * resize + k) * sizeof(RGBTRIPLE), pixel, sizeof(RGBTRIPLE));
- //*(line + (j * resize + k) * sizeof(RGBTRIPLE)) = *pixel;
- }
- free(pixel);
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement