RosettaCodeData/Task/Bitmap-Read-a-PPM-file/Yabasic/bitmap-read-a-ppm-file.basic

28 lines
503 B
Plaintext

sub readPPM(f$)
local ff, x, y, t$, dcol$, wid, hei
if f$ = "" print "No PPM file name indicate." : return false
ff = open (f$, "rb")
if not ff print "File ", f$, " not found." : return false
input #ff t$, wid, hei, dcol$
if t$ = "P6" then
open window wid, hei
for x = 0 to hei - 1
for y = 0 to wid - 1
color peek(#ff), peek(#ff), peek(#ff)
dot y, x
next y
next x
close #ff
else
print "File is NOT PPM P6 type." : return false
end if
return true
end sub