Skip to content

Commit

Permalink
Call captureScreen with arguments if passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 5, 2016
1 parent a764c66 commit da59926
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ bitmap.prototype.colorAt = function(x, y)
return robotjs.getColor(this, x, y);
};

module.exports.screen.capture = function()
module.exports.screen.capture = function(x, y, width, height)
{
b = robotjs.captureScreen();
//If coords have been passed, use them.
if (typeof x !== "undefined" && typeof y !== "undefined" && typeof width !== "undefined" && typeof height !== "undefined")
{
b = robotjs.captureScreen(x, y, width, height);
}
else
{
b = robotjs.captureScreen();
}

return new bitmap(b.width, b.height, b.byteWidth, b.bitsPerPixel, b.bytesPerPixel, b.image);
};

0 comments on commit da59926

Please sign in to comment.