GUAC-240: Add support for "img" instruction.

This commit is contained in:
Michael Jumper
2015-08-11 16:24:54 -07:00
parent 886c2f3a50
commit d393a833f4
2 changed files with 56 additions and 0 deletions

View File

@@ -527,6 +527,41 @@ Guacamole.Display = function() {
});
};
/**
* Draws the image contained within the specified Blob at the given
* coordinates. The Blob specified must already be populated with image
* data.
*
* @param {Guacamole.Layer} layer
* The layer to draw upon.
*
* @param {Number} x
* The destination X coordinate.
*
* @param {Number} y
* The destination Y coordinate.
*
* @param {Blob} blob
* The Blob containing the image data to draw.
*/
this.drawBlob = function(layer, x, y, blob) {
// Create URL for blob
var url = URL.createObjectURL(blob);
// Draw and free blob URL when ready
var task = scheduleTask(function __display_drawBlob() {
layer.drawImage(x, y, image);
URL.revokeObjectURL(url);
}, true);
// Load image from URL
var image = new Image();
image.onload = task.unblock;
image.src = url;
};
/**
* Draws the image at the specified URL at the given coordinates. The image
* will be loaded automatically, and this and any future operations will