Merge pull request #481 from Boelroy/master

Add the type function in Matrix class
This commit is contained in:
Peter Braden 2017-02-08 16:49:46 +01:00 committed by GitHub
commit c64b0ae5e1
2 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,7 @@ void Matrix::Init(Local<Object> target) {
Nan::SetPrototypeMethod(ctor, "pixel", Pixel);
Nan::SetPrototypeMethod(ctor, "width", Width);
Nan::SetPrototypeMethod(ctor, "height", Height);
Nan::SetPrototypeMethod(ctor, "type", Type);
Nan::SetPrototypeMethod(ctor, "size", Size);
Nan::SetPrototypeMethod(ctor, "clone", Clone);
Nan::SetPrototypeMethod(ctor, "crop", Crop);
@ -497,6 +498,12 @@ NAN_METHOD(Matrix::Size) {
info.GetReturnValue().Set(arr);
}
NAN_METHOD(Matrix::Type) {
SETUP_FUNCTION(Matrix)
info.GetReturnValue().Set(Nan::New<Int32>(self->mat.type()));
}
NAN_METHOD(Matrix::Clone) {
SETUP_FUNCTION(Matrix)

View File

@ -36,6 +36,7 @@ public:
JSFUNC(Size)
JSFUNC(Width)
JSFUNC(Height)
JSFUNC(Type)
JSFUNC(Channels)
JSFUNC(Clone)
JSFUNC(Ellipse)