diff --git a/lib/input_stream.js b/lib/input_stream.js index 3fc3105..22e5828 100644 --- a/lib/input_stream.js +++ b/lib/input_stream.js @@ -24,7 +24,9 @@ define(function() { calculatedWidth, calculatedHeight, _eventNames = ['canrecord', 'ended'], - _eventHandlers = {}; + _eventHandlers = {}, + _topRight = {x: 0, y: 0}, + _canvasSize = {x: 0, y: 0}; function loadImages() { loaded = false; @@ -41,6 +43,8 @@ define(function() { calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width; calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height; + _canvasSize.x = calculatedWidth; + _canvasSize.y = calculatedHeight; setTimeout(function() { publishEvent("canrecord", []); @@ -124,6 +128,24 @@ define(function() { } }; + that.setTopRight = function(topRight) { + _topRight.x = topRight.x; + _topRight.y = topRight.y; + }; + + that.getTopRight = function() { + return _topRight; + }; + + that.setCanvasSize = function(size) { + _canvasSize.x = size.x; + _canvasSize.y = size.y; + }; + + that.getCanvasSize = function() { + return _canvasSize; + }; + that.getFrame = function() { if (!loaded){ return null;