Convert a raster
object into an AmigaBasicShape
class object.
rasterToAmigaBasicShape(
x,
type = c("blitter object", "sprite"),
palette,
shadow,
collision,
...
)
Returns an AmigaBasicShape
class object based on x
.
A raster
class object to convert into a AmigaBasicShape
class obejct.
A character
string indicating what type of graphic needs to be created: "blitter object
" (default) or "sprite
".
A vector
of character
strings, where each element represents a colour. This palette is used to quantize the
colours that occur in the raster
x
.
An optional layer that could be stored with the graphics. This layer could be used for specific
shadow effects when blitting the graphics to the screen. It needs to be a raster
object consisting of the colours black (bit unset) and white (bit set). The raster needs to have the same dimensions
as x
. This layer will be omitted when this argument is omitted (or set to NULL
).
An optional layer that could be stored with the graphics. This layer could be used for collision
detection between graphical objects. It needs to be a raster
object consisting of the colours black (bit unset) and white (bit set). The raster needs to have the same dimensions
as x
. This layer will be omitted when this argument is omitted (or set to NULL
).
Arguments passed onto index.colours
. Can be used, for instance, to achieve specific dithering effects.
Pepijn de Vries
This method can be used to turn any graphics into an AmigaBasicShape
class object. In order to do
so, the colours of the input image (a raster
object) will be quantized to a
limited palette. This palette can be forced as an argument to this function. Otherwise, it will be based on
the input image.
Other AmigaBasicShape.operations:
AmigaBasicShape
,
read.AmigaBasicShape()
,
write.AmigaBasicShape()
Other raster.operations:
AmigaBitmapFont
,
as.raster.AmigaBasicShape()
,
bitmapToRaster()
,
dither()
,
index.colours()
,
rasterToAmigaBitmapFont()
,
rasterToBitmap()
,
rasterToHWSprite()
,
rasterToIFF()
if (FALSE) {
## get a raster image:
ilbm <- as.raster(read.iff(system.file("ilbm8lores.iff", package = "AmigaFFH")))
## convert to an Amiga Basic blitter object:
bob <- rasterToAmigaBasicShape(ilbm, "blitter object")
}
Run the code above in your browser using DataLab