mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
FEATURE HighGUI.cc: add resize window function
This commit is contained in:
parent
fa663d449b
commit
ece9efc8c9
@ -19,6 +19,7 @@ void NamedWindow::Init(Local<Object> target) {
|
|||||||
Nan::SetPrototypeMethod(ctor, "show", Show);
|
Nan::SetPrototypeMethod(ctor, "show", Show);
|
||||||
Nan::SetPrototypeMethod(ctor, "destroy", Destroy);
|
Nan::SetPrototypeMethod(ctor, "destroy", Destroy);
|
||||||
Nan::SetPrototypeMethod(ctor, "blockingWaitKey", BlockingWaitKey);
|
Nan::SetPrototypeMethod(ctor, "blockingWaitKey", BlockingWaitKey);
|
||||||
|
Nan::SetPrototypeMethod(ctor, "resizeWindow", ResizeWindow);
|
||||||
|
|
||||||
target->Set(Nan::New("NamedWindow").ToLocalChecked(), ctor->GetFunction());
|
target->Set(Nan::New("NamedWindow").ToLocalChecked(), ctor->GetFunction());
|
||||||
};
|
};
|
||||||
@ -34,7 +35,8 @@ NAN_METHOD(NamedWindow::New) {
|
|||||||
if (info.Length() == 1) {
|
if (info.Length() == 1) {
|
||||||
win = new NamedWindow(std::string(*Nan::Utf8String(info[0]->ToString())), 0);
|
win = new NamedWindow(std::string(*Nan::Utf8String(info[0]->ToString())), 0);
|
||||||
} else { //if (info.Length() == 2){
|
} else { //if (info.Length() == 2){
|
||||||
win = new NamedWindow(std::string(*Nan::Utf8String(info[0]->ToString())), 0);
|
win = new NamedWindow(std::string(*Nan::Utf8String(info[0]->ToString())),
|
||||||
|
info[1]->IntegerValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
win->Wrap(info.Holder());
|
win->Wrap(info.Holder());
|
||||||
@ -68,8 +70,6 @@ NAN_METHOD(NamedWindow::Destroy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NAN_METHOD(NamedWindow::BlockingWaitKey) {
|
NAN_METHOD(NamedWindow::BlockingWaitKey) {
|
||||||
Nan::HandleScope scope;
|
|
||||||
//SETUP_FUNCTION(NamedWindow)
|
|
||||||
int time = 0;
|
int time = 0;
|
||||||
|
|
||||||
if (info.Length() > 1) {
|
if (info.Length() > 1) {
|
||||||
@ -85,4 +85,16 @@ NAN_METHOD(NamedWindow::BlockingWaitKey) {
|
|||||||
info.GetReturnValue().Set(Nan::New<Number>(res));
|
info.GetReturnValue().Set(Nan::New<Number>(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NAN_METHOD(NamedWindow::ResizeWindow) {
|
||||||
|
SETUP_FUNCTION(NamedWindow)
|
||||||
|
|
||||||
|
if (info.Length() != 2) {
|
||||||
|
throw "expected 2 argurments: width, height";
|
||||||
|
}//otherwise
|
||||||
|
|
||||||
|
int width = info[0]->IntegerValue();
|
||||||
|
int height = info[1]->IntegerValue();
|
||||||
|
cv::resizeWindow(self->winname, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public:
|
|||||||
JSFUNC(Show)
|
JSFUNC(Show)
|
||||||
;JSFUNC(Destroy)
|
;JSFUNC(Destroy)
|
||||||
;JSFUNC(BlockingWaitKey)
|
;JSFUNC(BlockingWaitKey)
|
||||||
|
;JSFUNC(ResizeWindow)
|
||||||
;
|
;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user