Convert a grDevices raster object into an AmigaBasicShape class object.
Source:R/basic.r
rasterToAmigaBasicShape.Rd
Convert a raster()
object into an AmigaBasicShape()
class object.
Usage
rasterToAmigaBasicShape(
x,
type = c("blitter object", "sprite"),
palette,
shadow,
collision,
...
)
Arguments
- x
A
raster()
class object to convert into aAmigaBasicShape()
class obejct.- type
A
character
string indicating what type of graphic needs to be created: "blitter object
" (default) or "sprite
".- palette
A
vector
ofcharacter
strings, where each element represents a colour. This palette is used to quantize the colours that occur in theraster
x
.- shadow
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 asx
. This layer will be omitted when this argument is omitted (or set toNULL
).- collision
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 asx
. This layer will be omitted when this argument is omitted (or set toNULL
).- ...
Arguments passed onto
index.colours()
. Can be used, for instance, to achieve specific dithering effects.
Value
Returns an AmigaBasicShape()
class object based on x
.
Details
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.
See also
Other AmigaBasicShape.operations:
AmigaBasicShape
,
read.AmigaBasicShape()
,
write.AmigaBasicShape()
Other raster.operations:
AmigaBitmapFont
,
as.raster.AmigaBasicShape()
,
bitmapToRaster()
,
dither()
,
index.colours()
,
rasterToAmigaBitmapFont()
,
rasterToBitmap()
,
rasterToHWSprite()
,
rasterToIFF()
Examples
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")
}