Home Contents | # gfx.tileblit | Graphics | Core4 Lua Commands

## SYNOPSIS

1. gfx.tileblit(src, sx, sy, sw, sh, dst, dx, dy, dw, dh [, cow, coh])
2. gfx.tileblit(src, dst, dx, dy, dw, dh [, cow, coh])

## DESCRIPTION

Copies pixels from the src context to the dst context.

It is possible to specify different sizes for the source and destination. In that case, the algorithm will copy or truncate tiles from the source to fit the destination size.

The tiling works in multiple steps.

The four corners of the source are copied into the corners of the destination. The corner data is truncated if the destination rectangle is too small.

If the destination rectangle is wider or taller than the source rectangle, then the edges are filled in by copying strips from the source image multiple times to the top, bottom, left and right sides of the destination.

This might yet leave a still unhandled area in the middle of the destination. This area is flood-filled by picking a pixel color from the middle of the source.

The parameters are:

Param | Description | Default value
src | Source graphics context |
sx, sy, sw, sh | Position and size of the used rectangle in the source graphics. | Complete source area.
dst | Destination graphics context |
dx, dy, dw, dh | Position and size of the used rectangle in the destination graphics. | Complete destination area.
cow, coh | Optional size of the corner area in the source image. | 20% of the source rectangle width/height respectively.

## NOTES

This function is useful to paint GUI elements from a one-size-fits-all loaded image.

Internally, the implementation uses basic blitting and filling operations. These operations are subject to the configured gcx:blitMode() and gcx:alphaMode().

## SEE ALSO

gcx:blitMode, gcx:alphaMode