diff --git a/src/Matrix.cc b/src/Matrix.cc index d7b2ca1..177c7ee 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -37,6 +37,7 @@ Matrix::Init(Handle target) { NODE_SET_PROTOTYPE_METHOD(constructor, "width", Width); NODE_SET_PROTOTYPE_METHOD(constructor, "height", Height); NODE_SET_PROTOTYPE_METHOD(constructor, "size", Size); + NODE_SET_PROTOTYPE_METHOD(constructor, "clone", Clone); NODE_SET_PROTOTYPE_METHOD(constructor, "toBuffer", ToBuffer); NODE_SET_PROTOTYPE_METHOD(constructor, "toBufferAsync", ToBufferAsync); NODE_SET_PROTOTYPE_METHOD(constructor, "ellipse", Ellipse); @@ -210,6 +211,18 @@ Matrix::Size(const Arguments& args){ return scope.Close(arr); } +Handle +Matrix::Clone(const Arguments& args){ + SETUP_FUNCTION(Matrix) + + Local im_h = Matrix::constructor->GetFunction()->NewInstance(); + Matrix *m = ObjectWrap::Unwrap(im_h); + m->mat = self->mat.clone(); + + return scope.Close(im_h); +} + + Handle Matrix::Row(const Arguments& args){ SETUP_FUNCTION(Matrix) diff --git a/src/Matrix.h b/src/Matrix.h index 429e297..1379c56 100755 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -28,6 +28,7 @@ class Matrix: public node::ObjectWrap { JSFUNC(Width) JSFUNC(Height) JSFUNC(Channels) + JSFUNC(Clone) JSFUNC(Ellipse) JSFUNC(Rectangle)