make pixel-input stream aware of area

pull/65/head
Christoph Oberhofer 10 years ago
parent 4473521ae0
commit eda08cd9a7

@ -24,7 +24,9 @@ define(function() {
calculatedWidth, calculatedWidth,
calculatedHeight, calculatedHeight,
_eventNames = ['canrecord', 'ended'], _eventNames = ['canrecord', 'ended'],
_eventHandlers = {}; _eventHandlers = {},
_topRight = {x: 0, y: 0},
_canvasSize = {x: 0, y: 0};
function loadImages() { function loadImages() {
loaded = false; loaded = false;
@ -41,6 +43,8 @@ define(function() {
calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width; 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; calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;
_canvasSize.x = calculatedWidth;
_canvasSize.y = calculatedHeight;
setTimeout(function() { setTimeout(function() {
publishEvent("canrecord", []); 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() { that.getFrame = function() {
if (!loaded){ if (!loaded){
return null; return null;

Loading…
Cancel
Save