Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. // iterate over infile's scanlines
  2. for (int i = 0; i < abs(inputHeight); i++)
  3. {
  4. // iterate over pixels in scanline
  5. for (int j = 0; j < inputWidth; j++)
  6. {
  7. // temporary storage
  8. RGBTRIPLE triple;
  9.  
  10. // read RGB triple from infile
  11. fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
  12.  
  13. // duplicate each pixel n times horizontally
  14. for (int p = 0; p < n; p++)
  15. {
  16. // write RGB triple to outfile
  17. fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
  18. }
  19. }
  20. // temporary storage
  21. RGBTRIPLE triple2;
  22.  
  23. // read RGB triple from row of outfile
  24. fread(&triple2, sizeof(RGBTRIPLE), bi.biWidth, outptr);
  25.  
  26. // duplicate each row n times vertically
  27. for (int q = 0; q < n; q++)
  28. {
  29. fwrite(&triple2, sizeof(RGBTRIPLE), bi.biWidth, outptr);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement