if toBuffer has a cb, run it async. re #21

This commit is contained in:
Peter Braden 2012-11-09 10:21:41 -08:00
parent ac6c685b56
commit d71b0ae7b3
2 changed files with 6 additions and 2 deletions

View File

@ -304,6 +304,10 @@ Handle<Value>
Matrix::ToBuffer(const v8::Arguments& args){
SETUP_FUNCTION(Matrix)
if (args.Length() > 0){
return Matrix::ToBufferAsync(args);
}
std::vector<uchar> vec(0);
std::vector<int> params(0);//CV_IMWRITE_JPEG_QUALITY 90

View File

@ -138,12 +138,12 @@ vows.describe('Smoke Tests OpenCV').addBatch({
}
, "toBufferAsync": {
, "toBuffer Async": {
topic: function(cv){
var buf = fs.readFileSync('./examples/mona.png')
, cb = this.callback
cv.readImage(buf.slice(0), function(err, mat){
var buff = mat.toBufferAsync(function(){
var buff = mat.toBuffer(function(){
cb.apply(this, arguments)
})
})