dojox/gfx/canvas_attach.Surface (version 1.10)

Summary

a surface object to be used for drawings (Canvas)

Usage

var foo = new canvas_attach.Surface();
dojox/gfx/canvas

See the dojox/gfx/canvas_attach.Surface reference documentation for more information.

Property Summary

  • isLoaded
  • textDirWill be used as default for Text/TextPath/Group objects that created by this surface and textDir wasn't directly specified for them, though the bidi support was loaded.

Method Summary

Event Summary

  • onImageLoad()
  • onImagesLoaded() An extension point called when all pending images downloads have been completed.
  • onLoad(surface) local event, fired once when the surface is created asynchronously, used only when isLoaded is false, required only for Silverlight.

Properties

isLoaded
Defined by: dojox/gfx/shape
textDir

Will be used as default for Text/TextPath/Group objects that created by this surface and textDir wasn't directly specified for them, though the bidi support was loaded. Can be set in two ways:

  1. When the surface is created and textDir value passed to it as fourth parameter.
  2. Using the setTextDir(String) function, when this function is used the value of textDir propagates to all of it's children and the children of children (for Groups) etc.

Methods

_getRealMatrix()
Defined by dojox/gfx/shape

always returns the identity matrix

Returns:null
_init()
Defined by dojox/gfx/shape
_makeDirty()
Defined by dojox/gfx/canvas
_moveChildToBack(shape)
Defined by dojox/gfx/canvas
Parameter Type Description
shape undefined
Returns:undefined
_moveChildToFront(shape)
Defined by dojox/gfx/canvas
Parameter Type Description
shape undefined
Returns:undefined
_render(force)
Defined by dojox/gfx/canvas

render the all shapes

Parameter Type Description
force undefined
add(shape)
Defined by dojox/gfx/canvas
Parameter Type Description
shape undefined
Returns:undefined
clear()
Defined by dojox/gfx/canvas
Returns:undefined
closeBatch()
Defined by dojox/gfx/canvas

submits the current batch.

On canvas, this method flushes the pending redraws queue.

Returns:function

submits the current batch.

connect()
Defined by dojox/gfx/canvas
createCircle(circle)
Defined by dojox/gfx/shape

creates a circle shape

Parameter Type Description
circle Object

a circle object (see dojox/gfx.defaultCircle)

Returns:undefined
createEllipse(ellipse)
Defined by dojox/gfx/shape

creates an ellipse shape

Parameter Type Description
ellipse Object

an ellipse object (see dojox/gfx.defaultEllipse)

Returns:undefined
createGroup()
Defined by dojox/gfx/shape

creates a group shape

Returns:undefined
createImage(image)
Defined by dojox/gfx/shape

creates a image shape

Parameter Type Description
image Object

an image object (see dojox/gfx.defaultImage)

Returns:undefined
createLine(line)
Defined by dojox/gfx/shape

creates a line shape

Parameter Type Description
line Object

a line object (see dojox/gfx.defaultLine)

Returns:undefined
createObject(shapeType,rawShape)
Defined by dojox/gfx/canvas

creates an instance of the passed shapeType class

Parameter Type Description
shapeType Function

a class constructor to create an instance of

rawShape Object

properties to be passed in to the classes "setShape" method

Returns:instance
createPath(path)
Defined by dojox/gfx/shape

creates a path shape

Parameter Type Description
path Object

a path object (see dojox/gfx.defaultPath)

Returns:undefined
createPolyline(points)
Defined by dojox/gfx/shape

creates a polyline/polygon shape

Parameter Type Description
points Object

a points object (see dojox/gfx.defaultPolyline) or an Array of points

Returns:undefined
createRect(rect)
Defined by dojox/gfx/shape

creates a rectangle shape

Parameter Type Description
rect Object

a path object (see dojox/gfx.defaultRect)

Returns:undefined
createShape(shape)
Defined by dojox/gfx/shape

creates a shape object based on its type; it is meant to be used by group-like objects

Parameter Type Description
shape Object

a shape descriptor object

Returns:any | undefined | null

dojox/gfx/shape.Shape | Null a fully instantiated surface-specific Shape object

createText(text)
Defined by dojox/gfx/shape

creates a text shape

Parameter Type Description
text Object

a text object (see dojox/gfx.defaultText)

Returns:undefined
createTextPath(text)
Defined by dojox/gfx/shape

creates a text shape

Parameter Type Description
text Object

a textpath object (see dojox/gfx.defaultTextPath)

Returns:undefined
createViewport()
Defined by dojox/gfx3d/object
Returns:undefined
destroy()
Defined by dojox/gfx/canvas
disconnect()
Defined by dojox/gfx/canvas
downloadImage(img,url)
Defined by dojox/gfx/canvas

internal method, which starts an image download and renders, when it is ready

Parameter Type Description
img Image

the image object

url String

the url of the image

getBoundingBox()
Defined by dojox/gfx/canvas

Returns the bounding box Rectangle for this shape.

Returns:null
getDimensions()
Defined by dojox/gfx/canvas

returns an object with properties "width" and "height"

Returns:null
getEventSource()
Defined by dojox/gfx/canvas
Returns:null
getTextDir()
Returns:undefined
makeDirty()
Defined by dojox/gfx/canvas

internal method, which is called when we may need to redraw

on()
Defined by dojox/gfx/canvas
openBatch()
Defined by dojox/gfx/canvas

starts a new batch, subsequent new child shapes will be held in the batch instead of appending to the container directly.

Because the canvas renderer has no DOM hierarchy, the canvas implementation differs such that it suspends the repaint requests for this container until the current batch is closed by a call to closeBatch().

Returns:function

starts a new batch, subsequent new child shapes will be held in the batch instead of appending to the container directly.

remove(shape,silently)
Defined by dojox/gfx/canvas
Parameter Type Description
shape undefined
silently undefined
Returns:undefined
render(ctx)
Defined by dojox/gfx/canvas

Renders the gfx scene.

this method is called to render the gfx scene to the specified context. This method should not be invoked directly but should be used instead as an extension point on which user can connect to with aspect.before/aspect.after to implement pre- or post- image processing jobs on the drawing surface.

Parameter Type Description
ctx CanvasRenderingContext2D

The surface Canvas rendering context.

setDimensions(width,height)
Defined by dojox/gfx/canvas

sets the width and height of the rawNode

Parameter Type Description
width String

width of surface, e.g., "100px"

height String

height of surface, e.g., "100px"

Returns:function

sets the width and height of the rawNode

setTextDir(newTextDir)

Used for propagation and change of textDir. newTextDir will be forced as textDir for all of it's children (Group/Text/TextPath).

Parameter Type Description
newTextDir String
whenLoaded(context,method)
Defined by dojox/gfx/shape
Parameter Type Description
context Object | Null
method Function | String

Events

onImageLoad()
Defined by: dojox/gfx/canvas
onImagesLoaded()
Defined by: dojox/gfx/canvas

An extension point called when all pending images downloads have been completed.

This method is invoked when all pending images downloads have been completed, just before the gfx scene is redrawn. User can connect to this method to get notified when a gfx scene containing images is fully resolved.

onLoad(surface)
Defined by: dojox/gfx/shape

local event, fired once when the surface is created asynchronously, used only when isLoaded is false, required only for Silverlight.

Parameter Type Description
surface dojox/gfx/shape.Surface
Error in the documentation? Can’t find what you are looking for? Let us know!