1 |
|
2 |
|
3 | #pragma once
|
4 |
|
5 | #include <nan.h>
|
6 | #include <stdint.h> // node < 7 uses libstdc++ on macOS which lacks complete c++11
|
7 | #include <v8.h>
|
8 |
|
9 | class ImageData: public Nan::ObjectWrap {
|
10 | public:
|
11 | static Nan::Persistent<v8::FunctionTemplate> constructor;
|
12 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target);
|
13 | static NAN_METHOD(New);
|
14 | static NAN_GETTER(GetWidth);
|
15 | static NAN_GETTER(GetHeight);
|
16 |
|
17 | inline int width() { return _width; }
|
18 | inline int height() { return _height; }
|
19 | inline uint8_t *data() { return _data; }
|
20 | ImageData(uint8_t *data, int width, int height) : _width(width), _height(height), _data(data) {}
|
21 |
|
22 | private:
|
23 | int _width;
|
24 | int _height;
|
25 | uint8_t *_data;
|
26 |
|
27 | };
|