Handbook
Glossary
read-tinyvg ( -- tinyvg )
Vocabulary
tinyvg
Inputs
None
Outputs
tinyvg
an
object
Definition
USING:
accessors
combinators
endian
generalizations
io
kernel
math
math.bitwise
namespaces
sequences
;
IN:
tinyvg
:
read-tinyvg
( -- tinyvg )
[
tinyvg
new
2
read
tinyvg-magic
assert=
read1
tinyvg-version
assert=
read1
{
[
4
bits
>>scale
]
[
-4
shift
2
bits
>>color-encoding
]
[
-6
shift
[
>>coordinate-range
]
keep
]
}
cleave
{
2 1 4
}
nth
[
read
le>
]
curry
2
call-n
[
>>width
]
[
>>height
]
bi*
dup
scale>>
2^
scale-factor
set
dup
color-encoding>>
color-encoding
set
dup
coordinate-range>>
coordinate-range
set
read-varuint
read-color-table
>>color-table
dup
color-table>>
color-table
set
read-commands
>>commands
]
with-scope
;