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) rotation The angle of rotation in degrees (default 0). This rotation point is around the upper left corner of the image
-- 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
Comments
Article is closed for comments.