add matrix clone

This commit is contained in:
Peter Braden 2013-03-04 12:03:35 -08:00
parent 77279a33c0
commit 55cbf0a37f
2 changed files with 14 additions and 0 deletions

View File

@ -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);
@ -210,6 +211,18 @@ Matrix::Size(const Arguments& args){
return scope.Close(arr);
}
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 File

@ -28,6 +28,7 @@ class Matrix: public node::ObjectWrap {
JSFUNC(Width)
JSFUNC(Height)
JSFUNC(Channels)
JSFUNC(Clone)
JSFUNC(Ellipse)
JSFUNC(Rectangle)