Advertisement
Guest User

Untitled

a guest
Jul 31st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. // storage of bytes-to-write
  2. RGBTRIPLE* line = malloc(bi.biWidth * sizeof(RGBTRIPLE));
  3.  
  4. // iterate over infile's scanlines
  5. for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight / resize; i++)
  6. {
  7. // iterate over pixels in scanline
  8. for (int j = 0; j < bi.biWidth / resize; j++)
  9. {
  10. // read RGB triple from infile
  11. // storage of bytes read
  12. RGBTRIPLE* pixel = malloc(sizeof(RGBTRIPLE));
  13. fread(pixel, sizeof(RGBTRIPLE), 1, inptr);
  14. fseek(inptr, padding, SEEK_CUR);
  15.  
  16. //copying bytes read (stored in *pixel) to bytes-to-write (stored in *line)
  17. for (int k = 0; k < resize; k++)
  18. {
  19. //memcpy(line + (j * resize + k) * sizeof(RGBTRIPLE), pixel, sizeof(RGBTRIPLE));
  20. //*(line + (j * resize + k) * sizeof(RGBTRIPLE)) = *pixel;
  21. }
  22.  
  23. free(pixel);
  24. }
  25. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement