Bitmap/Write a PPM file: Difference between revisions

m
Changed "px" to "color" to match "bitmap.nim" interface.
m (Added export marker to “writePPM”.)
m (Changed "px" to "color" to match "bitmap.nim" interface.)
Line 1,336:
when isMainModule:
var image = initImage(100, 50)
image.fill(pxcolor(255, 0, 0))
for row in 10..20:
for col in 0..<image.w:
image[col, row] = pxcolor(0, 255, 0)
for row in 30..40:
for col in 0..<image.w:
image[col, row] = pxcolor(0, 0, 255)
image.writePPM("output.ppm")
</lang>
Anonymous user