How exactly does canvas work.compose () do Lua?

Canvas: compose (x, Y, canvas_src)

Makes the composition pixel by pixel between two canvas.

The canvas passed as SRC ' is drawn over the canvas in use (canvas) in the past position.

Receives:

  • x: [number] position X of the composition.
  • y: [number] composition position y.
  • canvas_src: [canvas] Canvas to be composed on canvas.

After operation, the target canvas has the result of composition and the canvas src is unchanged.

source: http://www.telemidia.puc-rio.br/~francisco/nclua/referencia/canvas.html#function_compose

Example:

canvas -> 1920 x 1080
imagem -> 1280 x 720

canvas.compose(0, 0, imagem)

How should the image be composed on canvas?

  1. The image is in position 0.0 (left / top) with the original size of 1280x720 and there is space left underneath and on the right side.

  2. Image starts at position 0.0 (left / top)and is increased to fill the entire canvas size (1920x1080).

 3
lua
Author: Comunidade, 2016-01-21

1 answers

  1. The image is in position 0.0 (left / top) with the original size of 1280x720 and is left with space below and on the right side.

  2. Canvas does not auto-resize by default. To resize a canvas you can try using the function: canvas: attrSize (height, width).

 0
Author: Henrique Becker, 2016-08-19 20:08:51