Fill img

From Sim Innovations Wiki
Jump to navigation Jump to search


_fill_img(file_name, x, y, width, height)
_fill_img(file_name, x, y, width, height, opacity)

_fill_img is used to apply all queued drawings into a fill (inside is the image provided).

Info This function may only be called within a canvas draw callback

Return value

This function won't return any value.


# Argument Type Description
1 file_name String File name of the image within the resource folder. Only PNG files are supported.
2 x Number X offset in pixels
3 y Number Y offset in pixels
4 width Number The width of the rendered image
5 height Number The height of the rendered image
6 opacity Number (Optional) The opacity in which the image should be drawn. Ranges from 0.0 (invisible) to 1.0 (completely visible).


canvas_id = canvas_add(0, 0, 200, 200, function()
  -- Create a rectangle
  _rect(0, 0, 100, 100)

  -- Draw the image within the rectangle
  _fill_img("test.png", 0, 0, 100, 100)