rasterToAmigaBasicShape: Convert a grDevices raster object into an AmigaBasicShape...

View source: R/basic.r

rasterToAmigaBasicShapeR Documentation

Convert a grDevices raster object into an AmigaBasicShape class object.

Description

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 a AmigaBasicShape() class obejct.

type

A character string indicating what type of graphic needs to be created: "⁠blitter object⁠" (default) or "sprite".

palette

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.

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 as x. This layer will be omitted when this argument is omitted (or set to NULL).

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 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.

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.

Value

Returns an AmigaBasicShape() class object based on x.

Author(s)

Pepijn de Vries

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

## Not run: 
## 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")

## End(Not run)

AmigaFFH documentation built on June 22, 2024, 11:03 a.m.