Bitmap/Write a PPM file: Difference between revisions
→{{header|Wren}}: Updated, about 90 times faster than before.
(→{{header|Wren}}: Updated, about 90 times faster than before.) |
|||
Line 2,527:
=={{header|Wren}}==
{{libheader|DOME}}
{{libheader|Wren-str}}
<syntaxhighlight lang="
import "dome" for Window, Process
import "io" for FileSystem
import "./str" for Strs
class Bitmap {
Line 2,551 ⟶ 2,552:
init() {
// write bitmap to a PPM file
var ppm = ["P6\n%(_w) %(_h)\n255\n"]
for (y in 0..._h) {
for (x in 0..._w) {
var c = pget(x, y)
ppm
ppm
ppm
}
}
FileSystem.save("output.ppm", Strs.concat(ppm))
Process.exit(0)
}
Line 2,574 ⟶ 2,575:
var Game = Bitmap.new("Bitmap - write to PPM file", 320, 320)</syntaxhighlight>
=={{header|XPL0}}==
<syntaxhighlight lang="xpl0">include c:\cxpl\codes; \intrinsic 'code' declarations
|