add the type function in Matrix class

This commit is contained in:
boelroy 2017-01-17 16:13:20 +08:00
parent a36fee5227
commit 12e3c6e25c
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)