Skip to content
angerangel edited this page Mar 15, 2013 · 1 revision

USAGE

   DECODE type data

DESCRIPTION

Decodes a series of bytes into the related datatype (e.g. image!).

DECODE is a function value.

ARGUMENTS

  • type -- Media type (jpeg, png, etc.) (word!)
  • data -- The data to decode (binary!)

#SOURCE

decode: make function! [  [
    {Decodes a series of bytes into the related datatype (e.g. image!).}
    type [word!] "Media type (jpeg, png, etc.)"
    data [binary!] "The data to decode"
    /local cod
][
    unless all [
        cod: select system/codecs type
        data: do-codec cod/entry 'decode data
    ] [
        cause-error 'access 'no-codec type
    ]
    data
] ]

Clone this wiki locally