rasterToHWSprite {AmigaFFH} | R Documentation |
Convert a raster object into an hardwareSprite object
Description
Convert a grDevices raster object into an Amiga hardwareSprite class object.
Usage
rasterToHWSprite(x, indexing = index.colours)
Arguments
x |
A |
indexing |
A function that accepts two arguments: |
Details
A grDevices()
raster image can be converted into a
hardwareSprite()
class object with this function. For this purpose
the any true-colour image will be converted to an indexed palette with 4 colours.
The Amiga hardware sprite will reserve one of the colours as transparent. Thos function
will use fully transparent colours in the original image (i.e., the alpha level equals 0)
for this purpose. Or when the image has no fully transparent colours, it will use the
most frequently occuring colour (at least when the default indexing
function
is used).
Value
Returns a hardwareSprite()
class object based on x
Author(s)
Pepijn de Vries
See Also
Other raster.operations:
AmigaBitmapFont
,
as.raster.AmigaBasicShape()
,
bitmapToRaster()
,
dither()
,
index.colours()
,
rasterToAmigaBasicShape()
,
rasterToAmigaBitmapFont()
,
rasterToBitmap()
,
rasterToIFF()
Other HWSprite.operations:
rawToHWSprite()
Examples
## Not run:
## first create a raster object that can be used as input
## (making sure that the background is transparent):
rst <- as.raster(simpleSysConfig()$PointerMatrix, "#AAAAAA00")
## now turn it into a hardware sprite:
spr <- rasterToHWSprite(rst)
## and plot it as a check:
plot(spr)
## End(Not run)