Handbook
Glossary
read-scanlines ( byte-reader loading-png width height -- array )
Vocabulary
images
.
png
Inputs
byte-reader
an
object
loading-png
an
object
width
an
object
height
an
object
Outputs
array
an
object
Definition
USING:
accessors
bitstreams
io
kernel
math
sequences
;
IN:
images.png
::
read-scanlines
( byte-reader loading-png width height -- array )
loading-png
png-components-per-pixel
:>
#components
loading-png
bit-depth>>
:>
bit-depth bit-depth
:>
depth!
#components width
*
:>
count! #components bit-depth
*
width
*
8
align
8
/i
:>
stride height
[
stride 1
+
byte-reader
stream-read
]
replicate
#components bit-depth 16
=
[
2
*
]
when
reverse-png-filter
bit-depth 16
=
[
8 depth! count 2
*
count!
]
when
<msb0-bit-reader>
:>
br height
[
count
[
depth br
read
]
B{
}
replicate-as
8 br
align
]
replicate
concat
;