Documentation for gcanvas.ew v0.10.5
Table of Contents

Canvas

A managed viewport into a larger graphex. This system is built on top of the 'graphex' system.


It is therefore better suited to use with the graphex drawing primitives. However, the graphex system is also being developed to incorporate other styles of drawing.

Start by creating a newGfxCanvas in a window with a certain width and height, then add objects with gfxCanvasAddObject and when you are ready call drawGfxCanvas with the id returned from newGfxCanvas.
All drawing is done from coordinates 0, 0 at the top left corner, and there is no practical limit to the size of the coordinates you use. By default scrollbars will be added if scrolling is needed to see the whole canvas.

  • proc drawGfxCanvas(integer canvasID)   Draw the canvas using the current view port offset
  • func getGfxCanvasOffset(integer canvasID)   Get the current view port offset
  • func gfxCanvasAddObject(canvasID, startx, starty, colour, "type", {points})   Add a graphex style object to the canvas.
  • func gfxCanvasRemoveObject(params)   Remove a graphex style shape from the canvas based on its ID
  • func newGfxCanvas(window_id, at_x, at_y, width, height)   Create a new canvas
  • proc setGfxCanvasOffset(integer canvasID, sequence topleft)   Change the top left coordinate offset (both X and Y) of the view port
  • proc setGfxCanvasXOffset(integer canvasID, integer x_offset)   Change the X offset of the view port
  • proc setGfxCanvasYOffset(integer canvasID, integer y_offset)   Change the Y offset of the view port

    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [proc]
    drawGfxCanvas
    (integer canvasID)

    Draw the canvas using the current view port offset

    Category: Canvas

    See Also: getGfxCanvasOffset, gfxCanvasAddObject, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [func]
    getGfxCanvasOffset
    (integer canvasID)

    Get the current view port offset

    Returns: sequence {x, y}

    Category: Canvas

    See Also: drawGfxCanvas, gfxCanvasAddObject, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [func]
    gfxCanvasAddObject
    (canvasID, startx, starty, colour, "type", {points})

    Add a graphex style object to the canvas.

    Returns: The unique shape/object ID for use with gfxCanvasRemoveObject

    Category: Canvas

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [func]
    gfxCanvasRemoveObject
    (params)

    Remove a graphex style shape from the canvas based on its ID

    Category: Canvas

    params is either a single integer (objectID) or a sequence of {canvasID,objectID} which is faster

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasAddObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [func]
    newGfxCanvas
    (window_id, at_x, at_y, width, height)

    Create a new canvas

    Returns: The integer id of the newly created canvas

    Category: Canvas

    The dimensions are of your VIEWPORT into a larger (auto sizing) graphex

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasAddObject, gfxCanvasRemoveObject, setGfxCanvasOffset, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [proc]
    setGfxCanvasOffset
    (integer canvasID, sequence topleft)

    Change the top left coordinate offset (both X and Y) of the view port

    Category: Canvas

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasAddObject, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasXOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [proc]
    setGfxCanvasXOffset
    (integer canvasID, integer x_offset)

    Change the X offset of the view port

    Category: Canvas

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasAddObject, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasYOffset


    Documentation for gcanvas.ew v0.10.5
    Table of Contents

    [proc]
    setGfxCanvasYOffset
    (integer canvasID, integer y_offset)

    Change the Y offset of the view port

    Category: Canvas

    See Also: drawGfxCanvas, getGfxCanvasOffset, gfxCanvasAddObject, gfxCanvasRemoveObject, newGfxCanvas, setGfxCanvasOffset, setGfxCanvasXOffset