new VisibleLayer(widthnon-null, heightnon-null)
Simple container for Guacamole.Layer, allowing layers to be easily
repositioned and nested. This allows certain operations to be accelerated
through DOM manipulation, rather than raster operations.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | The width of the Layer, in pixels. The canvas element backing this Layer will be given this width. |
height |
number | The height of the Layer, in pixels. The canvas element backing this Layer will be given this height. |
- Source:
Extends
Members
(non-null) alpha :number
The opacity of the layer container, where 255 is fully opaque and 0 is
fully transparent.
Type:
- number
- Source:
(non-null) autosize :boolean
Set to true if this Layer should resize itself to accommodate 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().
Type:
- boolean
- Inherited From:
- Default Value:
- false
- Source:
Example
// Set autosize to true for all future operations
layer.sync(function() {
layer.autosize = true;
});
(non-null) children :Object.<number, Guacamole.Display.VisibleLayer>
Set of all children of this layer, indexed by layer index. This object
will have one property per child.
Type:
- Object.<number, Guacamole.Display.VisibleLayer>
- Source:
(non-null) height :number
The current height of this layer.
Type:
- number
- Inherited From:
- Source:
(non-null) matrix :Array.<number>
The affine transformation applied to this layer container. Each element
corresponds to a value from the transformation matrix, with the first
three values being the first row, and the last three values being the
second row. There are six values total.
Type:
- Array.<number>
- Source:
parent :Guacamole.Display.VisibleLayer
The parent layer container of this layer, if any.
Type:
- Source:
(non-null) width :number
The current width of this layer.
Type:
- number
- Inherited From:
- Source:
(non-null) x :number
X coordinate of the upper-left corner of this layer container within
its parent, in pixels.
Type:
- number
- Source:
(non-null) y :number
Y coordinate of the upper-left corner of this layer container within
its parent, in pixels.
Type:
- number
- Source:
(non-null) z :number
Z stacking order of this layer relative to other sibling layers.
Type:
- number
- Source:
Methods
arc(xnon-null, ynon-null, radiusnon-null, startAnglenon-null, endAnglenon-null, negativenon-null)
Add the specified arc to the current path.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate of the center of the circle which will contain the arc. |
y |
number | The Y coordinate of the center of the circle which will contain the arc. |
radius |
number | The radius of the circle. |
startAngle |
number | The starting angle of the arc, in radians. |
endAngle |
number | The ending angle of the arc, in radians. |
negative |
boolean | Whether the arc should be drawn in order of decreasing angle. |
- Inherited From:
- Source:
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.
- Inherited From:
- Source:
close()
Closes the current path by connecting the end point with the start
point (if any) with a straight line.
- Inherited From:
- Source:
copy(srcLayernon-null, srcxnon-null, srcynon-null, srcwnon-null, srchnon-null, xnon-null, ynon-null)
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:
Name | Type | Description |
---|---|---|
srcLayer |
Guacamole.Layer | The Layer to copy image data from. |
srcx |
number | The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcy |
number | The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcw |
number | The width of the rectangle within the source Layer's coordinate space to copy data from. |
srch |
number | The height of the rectangle within the source Layer's coordinate space to copy data from. |
x |
number | The destination X coordinate. |
y |
number | The destination Y coordinate. |
- Inherited From:
- Source:
curveTo(cp1xnon-null, cp1ynon-null, cp2xnon-null, cp2ynon-null, xnon-null, ynon-null)
Starts a new path at the specified point.
Parameters:
Name | Type | Description |
---|---|---|
cp1x |
number | The X coordinate of the first control point. |
cp1y |
number | The Y coordinate of the first control point. |
cp2x |
number | The X coordinate of the second control point. |
cp2y |
number | The Y coordinate of the second control point. |
x |
number | The X coordinate of the endpoint of the curve. |
y |
number | The Y coordinate of the endpoint of the curve. |
- Inherited From:
- Source:
dispose()
Removes this layer container entirely, such that it is no longer
contained within its parent layer, if any.
- Source:
distort(anon-null, bnon-null, cnon-null, dnon-null, enon-null, fnon-null)
Applies the given affine transform (defined with six values from the
transform's matrix).
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The first value in the affine transform's matrix. |
b |
number | The second value in the affine transform's matrix. |
c |
number | The third value in the affine transform's matrix. |
d |
number | The fourth value in the affine transform's matrix. |
e |
number | The fifth value in the affine transform's matrix. |
f |
number | The sixth value in the affine transform's matrix. |
- Source:
drawImage(xnon-null, ynon-null, imagenon-null)
Draws the specified image at the given coordinates. The image specified
must already be loaded.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The destination X coordinate. |
y |
number | The destination Y coordinate. |
image |
CanvasImageSource | The image to draw. Note that this is not a URL. |
- Inherited From:
- Source:
fillColor(rnon-null, gnon-null, bnon-null, anon-null)
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:
Name | Type | Description |
---|---|---|
r |
number | The red component of the color to fill. |
g |
number | The green component of the color to fill. |
b |
number | The blue component of the color to fill. |
a |
number | The alpha component of the color to fill. |
- Inherited From:
- Source:
fillLayer(srcLayernon-null)
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:
Name | Type | Description |
---|---|---|
srcLayer |
Guacamole.Layer | The layer to use as a repeating pattern within the fill. |
- Inherited From:
- Source:
getCanvas() → (non-null) {HTMLCanvasElement}
Returns the canvas element backing this Layer. Note that the dimensions
of the canvas may not exactly match those of the Layer, as resizing a
canvas while maintaining its state is an expensive operation.
- Inherited From:
- Source:
Returns:
The canvas element backing this Layer.
- Type
- HTMLCanvasElement
getElement() → (non-null) {Element}
Returns the element containing the canvas and any other elements
associated with this layer.
- Source:
Returns:
The element containing this layer's canvas.
- Type
- Element
lineTo(xnon-null, ynon-null)
Add the specified line to the current path.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate of the endpoint of the line to draw. |
y |
number | The Y coordinate of the endpoint of the line to draw. |
- Inherited From:
- Source:
move(parentnon-null, xnon-null, ynon-null, znon-null)
Moves the upper-left corner of this VisibleLayer to the given X and Y
coordinate, sets the Z stacking order, and reparents this VisibleLayer
to the given VisibleLayer.
Parameters:
Name | Type | Description |
---|---|---|
parent |
Guacamole.Display.VisibleLayer | The parent to set. |
x |
number | The X coordinate to move to. |
y |
number | The Y coordinate to move to. |
z |
number | The Z coordinate to move to. |
- Source:
moveTo(xnon-null, ynon-null)
Starts a new path at the specified point.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate of the point to draw. |
y |
number | The Y coordinate of the point to draw. |
- Inherited From:
- Source:
pop()
Pop layer state off stack.
- Inherited From:
- Source:
push()
Push current layer state onto stack.
- Inherited From:
- Source:
put(srcLayernon-null, srcxnon-null, srcynon-null, srcwnon-null, srchnon-null, xnon-null, ynon-null)
Put a rectangle of image data from one Layer to this Layer directly
without performing any alpha blending. Simply copy the data.
Parameters:
Name | Type | Description |
---|---|---|
srcLayer |
Guacamole.Layer | The Layer to copy image data from. |
srcx |
number | The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcy |
number | The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcw |
number | The width of the rectangle within the source Layer's coordinate space to copy data from. |
srch |
number | The height of the rectangle within the source Layer's coordinate space to copy data from. |
x |
number | The destination X coordinate. |
y |
number | The destination Y coordinate. |
- Inherited From:
- Source:
rect(xnon-null, ynon-null, wnon-null, hnon-null)
Add the specified rectangle to the current path.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate of the upper-left corner of the rectangle to draw. |
y |
number | The Y coordinate of the upper-left corner of the rectangle to draw. |
w |
number | The width of the rectangle to draw. |
h |
number | The height of the rectangle to draw. |
- Inherited From:
- Source:
reset()
Reset the layer, clearing the stack, the current path, and any transform
matrix.
- Inherited From:
- Source:
resize(newWidthnon-null, newHeightnon-null)
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:
Name | Type | Description |
---|---|---|
newWidth |
number | The new width to assign to this Layer. |
newHeight |
number | The new height to assign to this Layer. |
- Overrides:
- Source:
setChannelMask(masknon-null)
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:
Name | Type | Description |
---|---|---|
mask |
number | The channel mask for future operations on this Layer. |
- Inherited From:
- Source:
setMiterLimit(limitnon-null)
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:
Name | Type | Description |
---|---|---|
limit |
number | The miter limit for stroke operations using the miter join. |
- Inherited From:
- Source:
setTransform(anon-null, bnon-null, cnon-null, dnon-null, enon-null, fnon-null)
Sets the given affine transform (defined with six values from the
transform's matrix).
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The first value in the affine transform's matrix. |
b |
number | The second value in the affine transform's matrix. |
c |
number | The third value in the affine transform's matrix. |
d |
number | The fourth value in the affine transform's matrix. |
e |
number | The fifth value in the affine transform's matrix. |
f |
number | The sixth value in the affine transform's matrix. |
- Inherited From:
- Source:
shade(anon-null)
Sets the opacity of this layer to the given value, where 255 is fully
opaque and 0 is fully transparent.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The opacity to set. |
- Source:
strokeColor(capnon-null, joinnon-null, thicknessnon-null, rnon-null, gnon-null, bnon-null, anon-null)
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:
Name | Type | Description |
---|---|---|
cap |
string | The line cap style. Can be "round", "square", or "butt". |
join |
string | The line join style. Can be "round", "bevel", or "miter". |
thickness |
number | The line thickness in pixels. |
r |
number | The red component of the color to fill. |
g |
number | The green component of the color to fill. |
b |
number | The blue component of the color to fill. |
a |
number | The alpha component of the color to fill. |
- Inherited From:
- Source:
strokeLayer(capnon-null, joinnon-null, thicknessnon-null, srcLayernon-null)
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:
Name | Type | Description |
---|---|---|
cap |
string | The line cap style. Can be "round", "square", or "butt". |
join |
string | The line join style. Can be "round", "bevel", or "miter". |
thickness |
number | The line thickness in pixels. |
srcLayer |
Guacamole.Layer | The layer to use as a repeating pattern within the stroke. |
- Inherited From:
- Source:
toCanvas() → (non-null) {HTMLCanvasElement}
Returns a new canvas element containing the same image as this Layer.
Unlike getCanvas(), the canvas element returned is guaranteed to have
the exact same dimensions as the Layer.
- Inherited From:
- Source:
Returns:
A new canvas element containing a copy of the image content this
Layer.
- Type
- HTMLCanvasElement
transfer(srcLayernon-null, srcxnon-null, srcynon-null, srcwnon-null, srchnon-null, xnon-null, ynon-null, transferFunctionnon-null)
Transfer a rectangle of image data from one Layer to this Layer using the
specified transfer function.
Parameters:
Name | Type | Description |
---|---|---|
srcLayer |
Guacamole.Layer | The Layer to copy image data from. |
srcx |
number | The X coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcy |
number | The Y coordinate of the upper-left corner of the rectangle within the source Layer's coordinate space to copy data from. |
srcw |
number | The width of the rectangle within the source Layer's coordinate space to copy data from. |
srch |
number | The height of the rectangle within the source Layer's coordinate space to copy data from. |
x |
number | The destination X coordinate. |
y |
number | The destination Y coordinate. |
transferFunction |
function | The transfer function to use to transfer data from source to destination. |
- Inherited From:
- Source:
transform(anon-null, bnon-null, cnon-null, dnon-null, enon-null, fnon-null)
Applies the given affine transform (defined with six values from the
transform's matrix).
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The first value in the affine transform's matrix. |
b |
number | The second value in the affine transform's matrix. |
c |
number | The third value in the affine transform's matrix. |
d |
number | The fourth value in the affine transform's matrix. |
e |
number | The fifth value in the affine transform's matrix. |
f |
number | The sixth value in the affine transform's matrix. |
- Inherited From:
- Source:
translate(xnon-null, ynon-null)
Moves the upper-left corner of this layer to the given X and Y
coordinate.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate to move to. |
y |
number | The Y coordinate to move to. |
- Source: