colourToAmigaRaw {AmigaFFH} | R Documentation |
Convert colours to Amiga compatible raw data or vice versa
Description
Convert colours to Amiga compatible raw data or vice versa, such that it can be used in graphical objects from the Commodore Amiga.
Usage
colourToAmigaRaw(
x,
colour.depth = c("12 bit", "24 bit"),
n.bytes = c("2", "3")
)
amigaRawToColour(
x,
colour.depth = c("12 bit", "24 bit"),
n.bytes = c("2", "3")
)
Arguments
x |
In the case |
colour.depth |
A |
n.bytes |
A |
Details
On the original Commodore Amiga chipset, graphics used indexed palettes of 12 bit colours. Colours are specified by their RGB (Red, Green and Blue) values, each component requiring 4 bits (with corresponding values ranging from 0 up to 15). Data structures on the Amiga were WORD (2 bytes) aligned. Colours are therefore typically stored in either 2 bytes (skipping the first four bits) or 3 bytes (one byte for each value).
These functions can be used to convert R colours into the closest matching
Amiga colour in a raw
format, or vice versa. Note that later Amiga
models with the advanced (graphics) architecture (known as AA or AGA) allowed
for 24 bit colours.
Value
In the case amigaRawToColour
is called, a (vector of)
colour character
string(s) is returned. When colourToAmigaRaw
is called, raw
representing the colour(s) specified in x
is
returned.
Author(s)
Pepijn de Vries
See Also
Other raw.operations:
as.AmigaBasic()
,
as.raw.AmigaBasic()
,
packBitmap()
,
rawToAmigaBasicBMAP()
,
rawToAmigaBasicShape()
,
rawToAmigaBasic()
,
rawToAmigaBitmapFontSet()
,
rawToAmigaBitmapFont()
,
rawToAmigaIcon()
,
rawToHWSprite()
,
rawToIFFChunk()
,
rawToSysConfig()
,
simpleAmigaIcon()
Examples
## Let's create some Amiga palettes:
colourToAmigaRaw(c("red", "navy blue", "brown", "#34AC5A"))
## let's do the reverse.
## this is white:
amigaRawToColour(as.raw(c(0x0f, 0xff)))
## this is white specified in 3 bytes:
amigaRawToColour(as.raw(c(0xf0, 0xf0, 0xf0)), n.bytes = "3")
## lower nybbles are ignored, you will get a warning when it is not zero:
amigaRawToColour(as.raw(c(0xf0, 0xf0, 0x0f)), n.bytes = "3")