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

3
  

canvas: compose (x, y, canvas_src)

     

Make the composition pixel by pixel between two canvases.

     

The canvas passed as src 'is drawn on the canvas in use (canvas)   in the past position.

     

Receives:

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

After the operation, the canvas destination canvas has the result of   composition and canvas src does not undergo any changes.

     

Source: link

Example:

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

canvas.compose(0, 0, imagem)

How should the image be composed on the canvas?

  • The image is in position 0,0 (left / top) with the original size of 1280x720 and is left space underneath and on the right.

  • The image starts at position 0,0 (left / top) and is enlarged to fill the entire canvas size (1920x1080).

  • asked by anonymous 21.01.2016 / 14:19

    1 answer

    0
  • The image is in position 0,0 (left / top) with the original size of 1280x720 and is left space underneath and on the right.

  • Canvas does not automatically resize by default. To resize a canvas you can try to use the canvas function: attrSize (height, width).

  • 19.08.2016 / 21:47