Handbook
Glossary
read-ppm ( -- image )
Vocabulary
images
.
ppm
Inputs
None
Outputs
image
an
object
Definition
USING:
accessors
combinators
images
io
kernel
make
math
;
IN:
images.ppm
::
read-ppm
( -- image )
read-token
:>
type
read-number
:>
width
read-number
:>
height
read-number
:>
max width height 3
*
*
:>
npixels type
{
{
"P3"
[
[
0 npixels
read-numbers
]
B{
}
make
]
}
{
"P6"
[
npixels
read
]
}
}
case
:>
data
image
new
RGB
>>component-order
{
width height
}
>>dim
f
>>upside-down?
data
>>bitmap
ubyte-components
>>component-type
;