|
11 | 11 | #include "MMBitmap.h"
|
12 | 12 | #include "snprintf.h"
|
13 | 13 | #include "microsleep.h"
|
| 14 | +#include "window.h" |
14 | 15 | #if defined(USE_X11)
|
15 | 16 | #include "xdisplay.h"
|
16 | 17 | #endif
|
@@ -710,6 +711,31 @@ Napi::Number _setXDisplayName(const Napi::CallbackInfo &info)
|
710 | 711 | #endif
|
711 | 712 | }
|
712 | 713 |
|
| 714 | +Napi::Number _highlight(const Napi::CallbackInfo &info) |
| 715 | +{ |
| 716 | + Napi::Env env = info.Env(); |
| 717 | + int x; |
| 718 | + int y; |
| 719 | + int width; |
| 720 | + int height; |
| 721 | + int duration; |
| 722 | + float opacity; |
| 723 | + |
| 724 | + if (info.Length() == 6) |
| 725 | + { |
| 726 | + x = info[0].As<Napi::Number>().Int32Value(); |
| 727 | + y = info[1].As<Napi::Number>().Int32Value(); |
| 728 | + width = info[2].As<Napi::Number>().Int32Value(); |
| 729 | + height = info[3].As<Napi::Number>().Int32Value(); |
| 730 | + duration = info[4].As<Napi::Number>().Int32Value(); |
| 731 | + opacity = info[5].As<Napi::Number>().FloatValue(); |
| 732 | + |
| 733 | + highlight(x, y, width, height, duration, opacity); |
| 734 | + return Napi::Number::New(env, 1); |
| 735 | + } |
| 736 | + return Napi::Number::New(env, 1); |
| 737 | +} |
| 738 | + |
713 | 739 | Napi::Object _captureScreen(const Napi::CallbackInfo &info)
|
714 | 740 | {
|
715 | 741 | Napi::Env env = info.Env();
|
@@ -873,6 +899,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
873 | 899 |
|
874 | 900 | exports.Set(Napi::String::New(env, "getPixelColor"), Napi::Function::New(env, _getPixelColor));
|
875 | 901 | exports.Set(Napi::String::New(env, "getScreenSize"), Napi::Function::New(env, _getScreenSize));
|
| 902 | + exports.Set(Napi::String::New(env, "highlight"), Napi::Function::New(env, _highlight)); |
876 | 903 | exports.Set(Napi::String::New(env, "captureScreen"), Napi::Function::New(env, _captureScreen));
|
877 | 904 | exports.Set(Napi::String::New(env, "getColor"), Napi::Function::New(env, _getColor));
|
878 | 905 | exports.Set(Napi::String::New(env, "getXDisplayName"), Napi::Function::New(env, _getXDisplayName));
|
|
0 commit comments