Convert colours to Amiga compatible raw data or vice versa, such that it can be used in graphical objects from the Commodore Amiga.
1 2 3 4 5 6 7 8 9 10 11
In the case
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.
In the case
amigaRawToColour is called, a (vector of)
character string(s) is returned. When
raw representing the colour(s) specified in
Pepijn de Vries
1 2 3 4 5 6 7 8 9 10 11 12
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.