Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // iterate over infile's scanlines
- for (int i = 0; i < abs(inputHeight); i++)
- {
- // iterate over pixels in scanline
- for (int j = 0; j < inputWidth; j++)
- {
- // temporary storage
- RGBTRIPLE triple;
- // read RGB triple from infile
- fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
- // duplicate each pixel n times horizontally
- for (int p = 0; p < n; p++)
- {
- // write RGB triple to outfile
- fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
- }
- }
- // temporary storage
- RGBTRIPLE triple2;
- // read RGB triple from row of outfile
- fread(&triple2, sizeof(RGBTRIPLE), bi.biWidth, outptr);
- // duplicate each row n times vertically
- for (int q = 0; q < n; q++)
- {
- fwrite(&triple2, sizeof(RGBTRIPLE), bi.biWidth, outptr);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement