Version2.0/Canvas

Last-modified: 2009-03-28 (土) 16:26:33
  • Canvas Canvas.new()
    Create a new canvas
  • Void Canvas.destroy(canvas)
    Destroy a canvas. Must be followed by canvas = nil
    Canvas (Canvas): canvas to destroy
  • CanvasObject Canvas.newLine(x1, y1, x2, y2, color)
    Create a new line
    x1, y1, x2, y2 (Number): coordinates of the line
    color (Color): color of the line
  • CanvasObject Canvas.newPoint(x1, y1, color)
    Create a new point
    x1, y1 (Number): coordinates of the point
    color (Color): color of the point
  • CanvasObject Canvas.newRect(x1, y1, x2, y2, color)
    Create a new rectangle
    x1, y1, x2, y2 (Number): coordinates of the rectangle
    color (Color): color of the rectangle
  • CanvasObject Canvas.newFillRect(x1, y1, x2, y2, color)
    Create a new fill rectangle
    x1, y1, x2, y2 (Number): coordinates of the rectangle
    color (Color): color of the rectangle
  • CanvasObject Canvas.newGradientRect(x1, y1, x2, y2, color1, color2, color3, color4)
    Create a new gradient rectangle
    x1, y1, x2, y2 (Number): coordinates of the rectangle
    color1, color2, color3, color4 (Color): colors of the fill rectangle
  • CanvasObject Canvas.newText(x1, y1, text [, color])
    Create a new text
    x1, y1 (Number): coordinates of the text
    text (String): text
    color (Color): color of the text
  • CanvasObject Canvas.newTextFont(x1, y1, text, color, font)
    Create a new text with a special font
    x1, y1 (Number): coordinates of the text
    text (String): text
    color (Color): color of the text
    font (Font): special font of the text
  • CanvasObject Canvas.newTextBox(x1, y1, x2, y2, text [, color])
    Create a new textbox
    x1, y1, x2, y2 (Number): coordinates of the textbox
    text (String): text
    color (Color): color of the textbox
  • CanvasObject Canvas.newImage(x1, y1, image [, x2, y2] [, x3, y3])
    Create a new image
    x1, y1 (Number): coordinates of the image
    x2, y2 (Number): coordinates in the source image to draw
    x3, y3 (Number): width and height of the rectangle to draw
  • Void Canvas.add(canvas, object)
    Add a CanvasObject in a canvas
    canvas (Canvas): canvas to draw
    object (CanvasObject): object to add
  • Void Canvas.draw(screen, canvas, x, y)
    Draw a canvas to the screen
    screen (Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)
    canvas (Canvas): canvas to draw
    x (Number): x-coordinate where to draw
    y (Number): y-coordinate where to draw
  • Void Canvas.setAttr(object, attrName, attrValue)
    Set an attribute value
    object (CanvasObject): object to modify
    attName (Constant): attribute to modify. Must be ATTR_XXX. See “some useful variables” for more details
    attrValue (?): new value for the attribute. Must be the good type
  • ? Canvas.getAttr(object, attrName)
    Get an attribute value. Return type depends of the attribute
    object (CanvasObject): object to use
    attName (Constant): attribute to get value. Must be ATTR_XXX. See “some useful variables” for more details