writeImage :: Scene -> [(Color,Int)] -> IO ()
writeImage scene pixels = do
    let (w, h)      = (width scene, height scene)
    let file        = outfile scene
    let sf          = 2^(superSample scene)
    let maxC        = 4*((fromIntegral sf)^2) :: RealT
    let (pix, cnts) = unzip pixels
    if outputSampleMap scene
        then do
            putStrLn $ "Total samples: " ++ (show (sum cnts))
            writePPM file w h (map (cnt2pix maxC) cnts)
        else
            writePPM file w h pix

-- Write pixels to PPM file
writeImage :: Scene -> [(Color,Int)] -> IO ()
writeImage scene pixels = do
    let (w, h)      = (width scene, height scene)
    let file        = outfile scene
    let sf          = 2^(superSample scene)
    let maxC        = 4*((fromIntegral sf)^2) :: RealT
    let (pix, cnts) = unzip pixels
    if outputSampleMap scene
        then do
            putStrLn $ "Total samples: " ++ (show (sum cnts))
            writePPM file w h (map (cnt2pix maxC) cnts)
        else
            writePPM file w h pix

-- Write pixels to PPM file
writeImage scene pixels = do
    let (w, h)      = (width scene, height scene)
    let file        = outfile scene
    let sf          = 2^(superSample scene)
    let maxC        = 4*((fromIntegral sf)^2) :: RealT
    let (pix, cnts) = unzip pixels
    if outputSampleMap scene
        then do
            putStrLn $ "Total samples: " ++ (show (sum cnts))
            writePPM file w h (map (cnt2pix maxC) cnts)
        else
            writePPM file w h pix

-- Write pixels to PPM file