canvas.drawImage(name, attrs)
Draw an image within the canvas directed by the user-specified properties.
Parameters: name The project-relative name of the image, the same as used in the image render extension attrs An object of variables containing information about how to draw the image. This object can contain the following optional variables: 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. halign The horizontal anchor, sb.LEFT, sb.CENTER, or sb.RIGHT (default: sb.LEFT) valign The vertical anchor, sb.TOP, sb.CENTER, or sb.BOTTOM (default: sb.TOP)
Example: // Draw an image scaled to the canvas size function drawImage(name) { var canvas = sb.getCanvas(name); var attrs = {w : canvas.width, h : canvas.height}; canvas.drawImage("images/logo.png", attrs); }