An S4 class object that represent graphical objects known as hardware sprites on the Commodore Amiga.
Details
Amiga hardware supported sprites, which are graphical objects that could be moved around the display and independently from each other. Basic sprites were 16 pixels wide and any number of pixels high and were composed of four colours, of which one is transparent.
More complex sprites could be formed by linking separate sprites together. That way, sprites could become wider, or be composed of more colours. Such extended sprites are currently not supported by this package.
A well known example of hardware sprite on the Commodore Amiga is the mouse pointer.
This object simply holds the basic information belonging to
hardware sprite. Use as.raster()
to convert it to
a raster which is a more useful graphical element in R.
Slots
VStart
The vertical starting position of a sprite.
HStart
The horizontal starting position of a sprite.
VStop
The vertical stopping position of a sprite. The height of a sprite should be given by
VStart
-VStop
.control.bits
8
logical
values used for extending sprites. The values are stored in this objects but extending sprites is not (yet) supported.bitmap
Interleaved bitmap data containing information on the pixel colour numbers of the sprite.
colours
A vector of the 3 colours used for the sprite.
end.of.data
Sprite data can be followed by another sprite. It is terminated with two WORDS equalling zero (
raw(4)
). Repeated sprite data is currently not supported.
Examples
## This generates a sprite of a single line (16x1 pixels) with an empty bitmap:
new("hardwareSprite")
#> A 1 row high hardware sprite sprite
## This generates a sprite of a single line (16x1 pixels) where
## the bitmap contains some coloured pixels:
new("hardwareSprite", bitmap = as.raw(c(0x01,0x02,0x03,0x04)))
#> A 1 row high hardware sprite sprite
## This generates a sprite of 16x16 pixels:
new("hardwareSprite",
VStop = 16,
bitmap = as.raw(sample.int(255, 64, replace = TRUE)))
#> A 16 row high hardware sprite sprite