An S4 class structure to represent data stored in the Interchange File Format (IFF).
Details
The Interchange File Format (IFF) was introduced in 1985 by Electronic Arts. This format stores files in standardised modular objects, called `chunks'. At the start of each chunk it is specified what type of data can be expected and what the size of this data is. This was a very forward thinking way of storing data, similar structures are still used in modern file formats (such as PNG images and XML files).
Although the IFF format is still in use, and new standardised chunk types can still be registered, this package will focus on the older chunk types that were primarily used on the Commodore Amiga (OS <= 3.0). IFF files could contain any kind of information. It could contain bitmap images, but also audio clips or (formatted) texts.
The IFFChunk
class is designed such that it theoretically can hold
any type of IFF data. This package will mostly focus on the early IFF file types
(i.e., IFF chunks as originally registered by Electronic Arts). IFF files are
read by this package in a none lossy way (read.iff()
), such that all
information is preserved (even if it is of an unknown type, as long as the chunk
identifier is 4 characters long).
This means that the object needs to be interpreted in order to make sense out of
it (interpretIFFChunk()
). This interpretation returns simplified
interpretations of class IFF.ANY
when it is supported (see
IFFChunk-method()
for supported chunk types). Note that in the
interpretation process (meta-)information may get lost. converting
IFF.ANY
objects back into IFFChunk()
objects (if possible)
could therefore result in an object that is different from then one stored in the
original file and could even destroy the correct interpretation of IFF objects.
IFF files should thus be handled with care.
Slots
chunk.type
A four
character
long code reflecting the type of information represented by this chunk.chunk.data
A
list
that holds either one or more validIFFChunk
s or a singlevector
ofraw
data. This data can only be interpreted in context of the specified type or in some cases information from otherIFFChunk
s.
References
https://wiki.amigaos.net/wiki/IFF_Standard
See also
Other iff.operations:
WaveToIFF()
,
as.raster.AmigaBasicShape()
,
getIFFChunk()
,
interpretIFFChunk()
,
rasterToIFF()
,
rawToIFFChunk()
,
read.iff()
,
write.iff()
Examples
## load an IFF file
example.iff <- read.iff(system.file("ilbm8lores.iff", package = "AmigaFFH"))
## 'example.iff' is of class IFFChunk:
class(example.iff)
#> [1] "IFFChunk"
#> attr(,"package")
#> [1] "AmigaFFH"
## let's plot it:
plot(example.iff)
## The default constructor will create an empty FORM:
new("IFFChunk")
#> - FORM
## The constructor can also be used to create simple chunks:
new("IFFChunk",
chunk.type = "TEXT",
chunk.data = list(charToRaw("A simple chunk")))
#> - TEXT