Class Index | File Index

Classes


Class Guacamole.Layer


Defined in: Layer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Guacamole.Layer(width, height)
Abstract ordered drawing surface.
Field Summary
Field Attributes Field Name and Description
<static>  
Guacamole.Layer.ATOP
Channel mask for the composite operation "atop".
 
Set to true if this Layer should resize itself to accomodate the dimensions of any drawing operation, and false (the default) otherwise.
 
The current height of this layer.
<static>  
Guacamole.Layer.IN
Channel mask for the composite operation "in".
<static>  
Guacamole.Layer.OUT
Channel mask for the composite operation "out".
<static>  
Guacamole.Layer.OVER
Channel mask for the composite operation "over".
<static>  
Guacamole.Layer.PLUS
Channel mask for the composite operation "plus".
<static>  
Guacamole.Layer.RATOP
Channel mask for the composite operation "ratop".
<static>  
Guacamole.Layer.RIN
Channel mask for the composite operation "rin".
<static>  
Guacamole.Layer.ROUT
Channel mask for the composite operation "rout".
<static>  
Guacamole.Layer.ROVER
Channel mask for the composite operation "rover".
<static>  
Guacamole.Layer.SRC
Channel mask for the composite operation "src".
 
The current width of this layer.
<static>  
Guacamole.Layer.XOR
Channel mask for the composite operation "xor".
Method Summary
Method Attributes Method Name and Description
 
arc(x, y, radius, startAngle, endAngle, negative)
Add the specified arc to the current path.
 
clip()
Clip all future drawing operations by the current path.
 
Closes the current path by connecting the end point with the start point (if any) with a straight line.
 
copy(srcLayer, srcx, srcy, srcw, srch, x, y)
Copy a rectangle of image data from one Layer to this Layer.
 
curveTo(cp1x, cp1y, cp2x, cp2y, x, y)
Starts a new path at the specified point.
 
drawImage(x, y, image)
Draws the specified image at the given coordinates.
 
fillColor(r, g, b, a)
Fills the current path with the specified color.
 
fillLayer(srcLayer)
Fills the current path with the image within the specified layer.
 
Returns the canvas element backing this Layer.
 
lineTo(x, y)
Add the specified line to the current path.
 
moveTo(x, y)
Starts a new path at the specified point.
 
pop()
Pop layer state off stack.
 
push()
Push current layer state onto stack.
 
put(srcLayer, srcx, srcy, srcw, srch, x, y)
Put a rectangle of image data from one Layer to this Layer directly without performing any alpha blending.
 
rect(x, y, w, h)
Add the specified rectangle to the current path.
 
Reset the layer, clearing the stack, the current path, and any transform matrix.
 
resize(newWidth, newHeight)
Changes the size of this Layer to the given width and height.
 
Sets the channel mask for future operations on this Layer.
 
Sets the miter limit for stroke operations using the miter join.
 
setTransform(a, b, c, d, e, f)
Sets the given affine transform (defined with six values from the transform's matrix).
 
strokeColor(cap, join, thickness, r, g, b, a)
Stroke the current path with the specified color.
 
strokeLayer(cap, join, thickness, srcLayer)
Stroke the current path with the image within the specified layer.
 
transfer(srcLayer, srcx, srcy, srcw, srch, x, y, transferFunction)
Transfer a rectangle of image data from one Layer to this Layer using the specified transfer function.
 
transform(a, b, c, d, e, f)
Applies the given affine transform (defined with six values from the transform's matrix).
Class Detail
Guacamole.Layer(width, height)
Abstract ordered drawing surface. Each Layer contains a canvas element and provides simple drawing instructions for drawing to that canvas element, however unlike the canvas element itself, drawing operations on a Layer are guaranteed to run in order, even if such an operation must wait for an image to load before completing.
Parameters:
{Number} width
The width of the Layer, in pixels. The canvas element backing this Layer will be given this width.
{Number} height
The height of the Layer, in pixels. The canvas element backing this Layer will be given this height.
Field Detail
<static> Guacamole.Layer.ATOP
Channel mask for the composite operation "atop".

{Boolean} autosize
Set to true if this Layer should resize itself to accomodate the dimensions of any drawing operation, and false (the default) otherwise. Note that setting this property takes effect immediately, and thus may take effect on operations that were started in the past but have not yet completed. If you wish the setting of this flag to only modify future operations, you will need to make the setting of this flag an operation with sync().
// Set autosize to true for all future operations
layer.sync(function() {
    layer.autosize = true;
});
Default Value:
false

{Number} height
The current height of this layer.

<static> Guacamole.Layer.IN
Channel mask for the composite operation "in". Beware that WebKit-based browsers may leave the contents of the destionation layer where the source layer is transparent, despite the definition of this operation.

<static> Guacamole.Layer.OUT
Channel mask for the composite operation "out". Beware that WebKit-based browsers may leave the contents of the destionation layer where the source layer is transparent, despite the definition of this operation.

<static> Guacamole.Layer.OVER
Channel mask for the composite operation "over".

<static> Guacamole.Layer.PLUS
Channel mask for the composite operation "plus".

<static> Guacamole.Layer.RATOP
Channel mask for the composite operation "ratop". Beware that WebKit-based browsers may leave the contents of the destionation layer where the source layer is transparent, despite the definition of this operation.

<static> Guacamole.Layer.RIN
Channel mask for the composite operation "rin". Beware that WebKit-based browsers may leave the contents of the destionation layer where the source layer is transparent, despite the definition of this operation.

<static> Guacamole.Layer.ROUT
Channel mask for the composite operation "rout".

<static> Guacamole.Layer.ROVER
Channel mask for the composite operation "rover".

<static> Guacamole.Layer.SRC
Channel mask for the composite operation "src". Beware that WebKit-based browsers may leave the contents of the destionation layer where the source layer is transparent, despite the definition of this operation.

{Number} width
The current width of this layer.

<static> Guacamole.Layer.XOR
Channel mask for the composite operation "xor".
Method Detail
arc(x, y, radius, startAngle, endAngle, negative)
Add the specified arc to the current path.
Parameters:
{Number} x
The X coordinate of the center of the circle which will contain the arc.
{Number} y
The Y coordinate of the center of the circle which will contain the arc.
{Number} radius
The radius of the circle.
{Number} startAngle
The starting angle of the arc, in radians.
{Number} endAngle
The ending angle of the arc, in radians.
{Boolean} negative
Whether the arc should be drawn in order of decreasing angle.

clip()
Clip all future drawing operations by the current path. The current path is implicitly closed. The current path can continue to be reused for other operations (such as fillColor()) but a new path will be started once a path drawing operation (path() or rect()) is used.

close()
Closes the current path by connecting the end point with the start point (if any) with a straight line.

copy(srcLayer, srcx, srcy, srcw, srch, x, y)
Copy a rectangle of image data from one Layer to this Layer. This operation will copy exactly the image data that will be drawn once all operations of the source Layer that were pending at the time this function was called are complete. This operation will not alter the size of the source Layer even if its autosize property is set to true.
Parameters:
{Guacamole.Layer} srcLayer
The Layer to copy image data from.
{Number} srcx
The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcy
The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcw
The width of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srch
The height of the rectangle within the source Layer's coordinate space to copy data from.
{Number} x
The destination X coordinate.
{Number} y
The destination Y coordinate.

curveTo(cp1x, cp1y, cp2x, cp2y, x, y)
Starts a new path at the specified point.
Parameters:
{Number} cp1x
The X coordinate of the first control point.
{Number} cp1y
The Y coordinate of the first control point.
{Number} cp2x
The X coordinate of the second control point.
{Number} cp2y
The Y coordinate of the second control point.
{Number} x
The X coordinate of the endpoint of the curve.
{Number} y
The Y coordinate of the endpoint of the curve.

drawImage(x, y, image)
Draws the specified image at the given coordinates. The image specified must already be loaded.
Parameters:
{Number} x
The destination X coordinate.
{Number} y
The destination Y coordinate.
{Image} image
The image to draw. Note that this is an Image object - not a URL.

fillColor(r, g, b, a)
Fills the current path with the specified color. The current path is implicitly closed. The current path can continue to be reused for other operations (such as clip()) but a new path will be started once a path drawing operation (path() or rect()) is used.
Parameters:
{Number} r
The red component of the color to fill.
{Number} g
The green component of the color to fill.
{Number} b
The blue component of the color to fill.
{Number} a
The alpha component of the color to fill.

fillLayer(srcLayer)
Fills the current path with the image within the specified layer. The image data will be tiled infinitely within the stroke. The current path is implicitly closed. The current path can continue to be reused for other operations (such as clip()) but a new path will be started once a path drawing operation (path() or rect()) is used.
Parameters:
{Guacamole.Layer} srcLayer
The layer to use as a repeating pattern within the fill.

{Element} getCanvas()
Returns the canvas element backing this Layer.
Returns:
{Element} The canvas element backing this Layer.

lineTo(x, y)
Add the specified line to the current path.
Parameters:
{Number} x
The X coordinate of the endpoint of the line to draw.
{Number} y
The Y coordinate of the endpoint of the line to draw.

moveTo(x, y)
Starts a new path at the specified point.
Parameters:
{Number} x
The X coordinate of the point to draw.
{Number} y
The Y coordinate of the point to draw.

pop()
Pop layer state off stack.

push()
Push current layer state onto stack.

put(srcLayer, srcx, srcy, srcw, srch, x, y)
Put a rectangle of image data from one Layer to this Layer directly without performing any alpha blending. Simply copy the data.
Parameters:
{Guacamole.Layer} srcLayer
The Layer to copy image data from.
{Number} srcx
The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcy
The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcw
The width of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srch
The height of the rectangle within the source Layer's coordinate space to copy data from.
{Number} x
The destination X coordinate.
{Number} y
The destination Y coordinate.

rect(x, y, w, h)
Add the specified rectangle to the current path.
Parameters:
{Number} x
The X coordinate of the upper-left corner of the rectangle to draw.
{Number} y
The Y coordinate of the upper-left corner of the rectangle to draw.
{Number} w
The width of the rectangle to draw.
{Number} h
The height of the rectangle to draw.

reset()
Reset the layer, clearing the stack, the current path, and any transform matrix.

resize(newWidth, newHeight)
Changes the size of this Layer to the given width and height. Resizing is only attempted if the new size provided is actually different from the current size.
Parameters:
{Number} newWidth
The new width to assign to this Layer.
{Number} newHeight
The new height to assign to this Layer.

setChannelMask(mask)
Sets the channel mask for future operations on this Layer. The channel mask is a Guacamole-specific compositing operation identifier with a single bit representing each of four channels (in order): source image where destination transparent, source where destination opaque, destination where source transparent, and destination where source opaque.
Parameters:
{Number} mask
The channel mask for future operations on this Layer.

setMiterLimit(limit)
Sets the miter limit for stroke operations using the miter join. This limit is the maximum ratio of the size of the miter join to the stroke width. If this ratio is exceeded, the miter will not be drawn for that joint of the path.
Parameters:
{Number} limit
The miter limit for stroke operations using the miter join.

setTransform(a, b, c, d, e, f)
Sets the given affine transform (defined with six values from the transform's matrix).
Parameters:
{Number} a
The first value in the affine transform's matrix.
{Number} b
The second value in the affine transform's matrix.
{Number} c
The third value in the affine transform's matrix.
{Number} d
The fourth value in the affine transform's matrix.
{Number} e
The fifth value in the affine transform's matrix.
{Number} f
The sixth value in the affine transform's matrix.

strokeColor(cap, join, thickness, r, g, b, a)
Stroke the current path with the specified color. The current path is implicitly closed. The current path can continue to be reused for other operations (such as clip()) but a new path will be started once a path drawing operation (path() or rect()) is used.
Parameters:
{String} cap
The line cap style. Can be "round", "square", or "butt".
{String} join
The line join style. Can be "round", "bevel", or "miter".
{Number} thickness
The line thickness in pixels.
{Number} r
The red component of the color to fill.
{Number} g
The green component of the color to fill.
{Number} b
The blue component of the color to fill.
{Number} a
The alpha component of the color to fill.

strokeLayer(cap, join, thickness, srcLayer)
Stroke the current path with the image within the specified layer. The image data will be tiled infinitely within the stroke. The current path is implicitly closed. The current path can continue to be reused for other operations (such as clip()) but a new path will be started once a path drawing operation (path() or rect()) is used.
Parameters:
{String} cap
The line cap style. Can be "round", "square", or "butt".
{String} join
The line join style. Can be "round", "bevel", or "miter".
{Number} thickness
The line thickness in pixels.
{Guacamole.Layer} srcLayer
The layer to use as a repeating pattern within the stroke.

transfer(srcLayer, srcx, srcy, srcw, srch, x, y, transferFunction)
Transfer a rectangle of image data from one Layer to this Layer using the specified transfer function.
Parameters:
{Guacamole.Layer} srcLayer
The Layer to copy image data from.
{Number} srcx
The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcy
The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srcw
The width of the rectangle within the source Layer's coordinate space to copy data from.
{Number} srch
The height of the rectangle within the source Layer's coordinate space to copy data from.
{Number} x
The destination X coordinate.
{Number} y
The destination Y coordinate.
{Function} transferFunction
The transfer function to use to transfer data from source to destination.

transform(a, b, c, d, e, f)
Applies the given affine transform (defined with six values from the transform's matrix).
Parameters:
{Number} a
The first value in the affine transform's matrix.
{Number} b
The second value in the affine transform's matrix.
{Number} c
The third value in the affine transform's matrix.
{Number} d
The fourth value in the affine transform's matrix.
{Number} e
The fifth value in the affine transform's matrix.
{Number} f
The sixth value in the affine transform's matrix.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jun 10 2015 21:35:44 GMT-0700 (PDT)