View source: R/hardwareSprites.r
rasterToHWSprite | R Documentation |
Convert a grDevices raster object into an Amiga hardwareSprite class object.
rasterToHWSprite(x, indexing = index.colours)
x |
A |
indexing |
A function that accepts two arguments: |
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).
Returns a hardwareSprite()
class object based on x
Pepijn de Vries
Other raster.operations:
AmigaBitmapFont
,
as.raster.AmigaBasicShape()
,
bitmapToRaster()
,
dither()
,
index.colours()
,
rasterToAmigaBasicShape()
,
rasterToAmigaBitmapFont()
,
rasterToBitmap()
,
rasterToIFF()
Other HWSprite.operations:
rawToHWSprite()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.