Skip to content

Commit

Permalink
Merge pull request #729 from lolikung/master
Browse files Browse the repository at this point in the history
Add putTextAsync method
  • Loading branch information
justadudewhohacks authored Jun 4, 2020
2 parents 0725d42 + 1cba511 commit 24bff92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cc/imgproc/MatImgproc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void MatImgproc::Init(v8::Local<v8::FunctionTemplate> ctor) {
Nan::SetPrototypeMethod(ctor, "drawFillPoly", DrawFillPoly);
Nan::SetPrototypeMethod(ctor, "drawFillConvexPoly", DrawFillConvexPoly);
Nan::SetPrototypeMethod(ctor, "putText", PutText);
Nan::SetPrototypeMethod(ctor, "putTextAsync", PutTextAsync);
Nan::SetPrototypeMethod(ctor, "matchTemplate", MatchTemplate);
Nan::SetPrototypeMethod(ctor, "matchTemplateAsync", MatchTemplateAsync);
Nan::SetPrototypeMethod(ctor, "canny", Canny);
Expand Down Expand Up @@ -546,6 +547,14 @@ NAN_METHOD(MatImgproc::PutText) {
);
}

NAN_METHOD(MatImgproc::PutTextAsync) {
FF::executeAsyncBinding(
std::make_shared<MatImgprocBindings::PutTextWorker>(Mat::unwrapSelf(info)),
"Mat::PutTextAsync",
info
);
}

NAN_METHOD(MatImgproc::MatchTemplate) {
FF::executeSyncBinding(
std::make_shared<MatImgprocBindings::MatchTemplateWorker>(Mat::unwrapSelf(info)),
Expand Down
1 change: 1 addition & 0 deletions cc/imgproc/MatImgproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class MatImgproc {
static NAN_METHOD(DrawFillPoly);
static NAN_METHOD(DrawFillConvexPoly);
static NAN_METHOD(PutText);
static NAN_METHOD(PutTextAsync);
static NAN_METHOD(MatchTemplate);
static NAN_METHOD(MatchTemplateAsync);
static NAN_METHOD(Canny);
Expand Down
1 change: 1 addition & 0 deletions lib/typings/Mat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export class Mat {
pushBack(mat: Mat): Mat;
pushBackAsync(mat: Mat): Promise<Mat>;
putText(text: string, origin: Point2, fontFace: number, fontScale: number, color?: Vec3, thickness?: number, lineType?: number, bottomLeftOrigin?: boolean): void;
putTextAsync(text: string, origin: Point2, fontFace: number, fontScale: number, color?: Vec3, thickness?: number, lineType?: number, bottomLeftOrigin?: boolean): Promise<void>;
pyrDown(size?: Size, borderType?: number): Mat;
pyrDownAsync(size?: Size, borderType?: number): Promise<Mat>;
pyrUp(size?: Size, borderType?: number): Mat;
Expand Down

0 comments on commit 24bff92

Please sign in to comment.