Permalink
Browse files

add matrix clone

  • Loading branch information...
1 parent 77279a3 commit 55cbf0a37f97fb4f2c81c25bf0c13fe747aaf1ca @peterbraden committed Mar 4, 2013
Showing with 14 additions and 0 deletions.
  1. +13 −0 src/Matrix.cc
  2. +1 −0 src/Matrix.h
View
@@ -37,6 +37,7 @@ Matrix::Init(Handle<Object> 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);
@@ -211,6 +212,18 @@ Matrix::Size(const Arguments& args){
}
Handle<Value>
+Matrix::Clone(const Arguments& args){
+ SETUP_FUNCTION(Matrix)
+
+ Local<Object> im_h = Matrix::constructor->GetFunction()->NewInstance();
+ Matrix *m = ObjectWrap::Unwrap<Matrix>(im_h);
+ m->mat = self->mat.clone();
+
+ return scope.Close(im_h);
+}
+
+
+Handle<Value>
Matrix::Row(const Arguments& args){
SETUP_FUNCTION(Matrix)
View
@@ -28,6 +28,7 @@ class Matrix: public node::ObjectWrap {
JSFUNC(Width)
JSFUNC(Height)
JSFUNC(Channels)
+ JSFUNC(Clone)
JSFUNC(Ellipse)
JSFUNC(Rectangle)

0 comments on commit 55cbf0a

Please sign in to comment.