Skip to main content
2 of 4
added 78 characters in body
kzidane
  • 17.7k
  • 3
  • 28
  • 100

You're code is not quite clear to me, but you may check what you've already done of these steps

Approach #1:

for each scanline in the original BMP
{
    get the location of the file position indicator

    repeat n times // resize vertically
    {
        if we're not at the beginning of the current scanline
        {
            set the file position indicator back at the beginning of the scanline
        }

        for each RGBTRIPLE in this scanline
        {
            read an RGBTRIPLE
            write that RGBTRIPLE n times // resize horizontally
        }

        write the new padding to the new BMP
    }

    skip the old padding
}

Approach #2:

for each scanline in the original BMP
{
    create an RGBTRIPLEs array named triples of size (original width * 2)
    
    for each RGBTRIPLE in the current scanline
    {
        read an RGBTRIPLE
        
        repeat n times // resize horizontally
        {
            store the RGBTRIPLE into the current index of triples
        }
    }

    // resize resize vertically
    repeat n times
    {
        write the whole array into the new BMP
        write the new padding
    }      
    
    skip the old padding
}

Hope that helps!

kzidane
  • 17.7k
  • 3
  • 28
  • 100