CANVAS:draw image

CANVAS:draw_image(name, attrs)

Draw an image within the canvas directed by the user specified properties.

Parameters: name The project relative name of the image, same as used in the Image attrs A table of properties containing information about how to draw the image. This table can contain the following keys: x The x position of the upper left corner of the text (default 0) y The y position of the upper left corner of the text (default 0) w The width to scale the image to (default: natural width) h The height to scale the image to (default: natural height)

-- Draw an image scaled to the canvas size
function DrawImage(name)
    local canvas = gre.get_canvas(name)
    local size = canvas:get_dimensions()
    local attrs = {}
    attrs.w = size.width
    attrs.h = size.height
    canvas:draw_image("images/logo.png", attrs)
end
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.