+ this.getScale = function() {
+ return displayScale;
+ };
+
+};
+
+/**
+ * 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.
+ *
+ * @constructor
+ *
+ * @param {Number} width The width of the Layer, in pixels. The canvas element
+ * backing this Layer will be given this width.
+ *
+ * @param {Number} height The height of the Layer, in pixels. The canvas element
+ * backing this Layer will be given this height.
+ */
+Guacamole.Client.LayerContainer = function(width, height) {
+
+ /**
+ * Reference to this LayerContainer.
+ * @private
+ */
+ var layer_container = this;
+
+ // Create layer with given size
+ var layer = new Guacamole.Layer(width, height);
+
+ // Set layer position
+ var canvas = layer.getCanvas();
+ canvas.style.position = "absolute";
+ canvas.style.left = "0px";
+ canvas.style.top = "0px";
+
+ // Create div with given size
+ var div = document.createElement("div");
+ div.appendChild(canvas);
+ div.style.width = width + "px";
+ div.style.height = height + "px";
+
+ /**
+ * Changes the size of this LayerContainer and the contained Layer to the
+ * given width and height.
+ *
+ * @param {Number} width The new width to assign to this Layer.
+ * @param {Number} height The new height to assign to this Layer.
+ */
+ this.resize = function(width, height) {
+
+ // Resize layer
+ layer.resize(width, height);
+
+ // Resize containing div
+ div.style.width = width + "px";
+ div.style.height = height + "px";
+
+ };
+
+ /**
+ * Returns the Layer contained within this LayerContainer.
+ * @returns {Guacamole.Layer} The Layer contained within this LayerContainer.
+ */
+ this.getLayer = function() {
+ return layer;
+ };
+
+ /**
+ * Returns the element containing the Layer within this LayerContainer.
+ * @returns {Element} The element containing the Layer within this LayerContainer.
+ */
+ this.getElement = function() {
+ return div;
+ };
+
+ /**
+ * The translation component of this LayerContainer's transform.
+ * @private
+ */
+ var translate = "translate(0px, 0px)"; // (0, 0)
+
+ /**
+ * The arbitrary matrix component of this LayerContainer's transform.
+ * @private
+ */
+ var matrix = "matrix(1, 0, 0, 1, 0, 0)"; // Identity
+
+ /**
+ * Moves the upper-left corner of this LayerContainer to the given X and Y
+ * coordinate.
+ *
+ * @param {Number} x The X coordinate to move to.
+ * @param {Number} y The Y coordinate to move to.
+ */
+ this.translate = function(x, y) {
+
+ // Generate translation
+ translate = "translate("
+ + x + "px,"
+ + y + "px)";
+
+ // Set layer transform
+ div.style.transform =
+ div.style.WebkitTransform =
+ div.style.MozTransform =
+ div.style.OTransform =
+ div.style.msTransform =
+
+ translate + " " + matrix;
+
+ };
+
+ /**
+ * Applies the given affine transform (defined with six values from the
+ * transform's matrix).
+ *
+ * @param {Number} a The first value in the affine transform's matrix.
+ * @param {Number} b The second value in the affine transform's matrix.
+ * @param {Number} c The third value in the affine transform's matrix.
+ * @param {Number} d The fourth value in the affine transform's matrix.
+ * @param {Number} e The fifth value in the affine transform's matrix.
+ * @param {Number} f The sixth value in the affine transform's matrix.
+ */
+ this.transform = function(a, b, c, d, e, f) {
+
+ // Generate matrix transformation
+ matrix =
+
+ /* a c e
+ * b d f
+ * 0 0 1
+ */