IFFChunk-method {AmigaFFH}R Documentation

Coerce to and create IFFChunk objects

Description

Convert IFF.ANY objects (created with interpretIFFChunk()) into IFFChunk() objects. A basic IFFChunk() can also be created with this method by providing the chunk type name.

Usage

IFFChunk(x, ...)

## S3 method for class 'character'
IFFChunk(x, ...)

## S3 method for class 'IFF.FORM'
IFFChunk(x, ...)

## S3 method for class 'IFF.BODY'
IFFChunk(x, ...)

## S3 method for class 'IFF.ANNO'
IFFChunk(x, ...)

## S3 method for class 'IFF.AUTH'
IFFChunk(x, ...)

## S3 method for class 'IFF.CHRS'
IFFChunk(x, ...)

## S3 method for class 'IFF.NAME'
IFFChunk(x, ...)

## S3 method for class 'IFF.TEXT'
IFFChunk(x, ...)

## S3 method for class 'IFF.copyright'
IFFChunk(x, ...)

## S3 method for class 'IFF.CHAN'
IFFChunk(x, ...)

## S3 method for class 'IFF.VHDR'
IFFChunk(x, ...)

## S3 method for class 'IFF.8SVX'
IFFChunk(x, ...)

## S3 method for class 'IFF.ILBM'
IFFChunk(x, ...)

## S3 method for class 'IFF.CMAP'
IFFChunk(x, ...)

## S3 method for class 'IFF.BMHD'
IFFChunk(x, ...)

## S3 method for class 'IFF.CAMG'
IFFChunk(x, ...)

## S3 method for class 'IFF.CRNG'
IFFChunk(x, ...)

## S3 method for class 'IFF.ANIM'
IFFChunk(x, ...)

## S3 method for class 'IFF.ANHD'
IFFChunk(x, ...)

## S3 method for class 'IFF.DLTA'
IFFChunk(x, ...)

## S3 method for class 'IFF.DPAN'
IFFChunk(x, ...)

Arguments

x

An S3 class IFF.ANY object that needs to be coerced into an IFFChunk-class() object. IFF.ANY objects are created with the interpretIFFChunk() method. x can also be a character string of a IFF chunk type (e.g., "FORM" or "BMHD"). In that case an IFFChunk() object of that type is created with some basic content.

...

Arguments passed onto methods underlying the interpretation of the specific IFF chunks. Allowed arguments depend on the specific type of IFF chunk that x represents.

Details

IFF data is stored in a IFFChunk-class() object when read from an IFF file (read.iff()). These objects reflect the file structure well, but the data is stored as raw information. IFF files can contain a wide variety of information types, ranging from bitmap images to audio clips. The raw information stored in IFFChunk() objects can be interpreted into more meaningful representations that can be handled in R. This is achieved with the interpretIFFChunk() method, which returns IFF.ANY objects.

These IFF.ANY objects are a less strict representation of the IFF Chunk, but are easier to handle in R. The interpretation method is lossy and may not preserve all information in the IFF.ANY object. The IFFChunk-method() can coerce IFF.ANY back to the more strictly defined IFFChunk-class() objects. Be careful with conversions between IFFChunk-class() and IFF.ANY objects and vice versa, as information may get lost.

More detailed information about IFF chunks can be found in the IFF chunk registry (see references).

Value

Returns an IFFChunk-class() representation of x.

References

https://wiki.amigaos.net/wiki/IFF_FORM_and_Chunk_Registry

Examples

## Not run: 
## load an IFF file
example.iff <- read.iff(system.file("ilbm8lores.iff", package = "AmigaFFH"))

## interpret the IFF file (in some cases information
## will get lost in this step):
example.itpt <- interpretIFFChunk(example.iff)

## now coerce back to a formal IFFChunk class object.
## Only information in the interpreted object is used
## The coerced object may therefore depart from the
## original read from the file.
example.coerce <- IFFChunk(example.itpt)

## and indeed the objects are not identical, as shown below.
## In this case the difference is not disastrous, the order
## of the colours in the palette have shifted. But be careful
## with switching between formal IFFChunk objects and
## interpreted IFF.ANY objects.
identical(example.iff, example.coerce)

## It is also possible to create simple IFFChunk objects
## by providing the desired chunk type identifier as a
## character string.

## This creates a basic bitmap header:
bmhd <- IFFChunk("BMHD")

## This creates a basic colour palette:
cmap <- IFFChunk("CMAP")

## End(Not run)

[Package AmigaFFH version 0.4.5 Index]