1 |
|
2 |
|
3 | #pragma once
|
4 |
|
5 | #include <cairo.h>
|
6 | #include <nan.h>
|
7 | #include <v8.h>
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | typedef enum {
|
14 | NO_REPEAT,
|
15 | REPEAT,
|
16 | REPEAT_X,
|
17 | REPEAT_Y
|
18 | } repeat_type_t;
|
19 |
|
20 | extern const cairo_user_data_key_t *pattern_repeat_key;
|
21 |
|
22 | class Pattern: public Nan::ObjectWrap {
|
23 | public:
|
24 | static Nan::Persistent<v8::FunctionTemplate> constructor;
|
25 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target);
|
26 | static NAN_METHOD(New);
|
27 | static repeat_type_t get_repeat_type_for_cairo_pattern(cairo_pattern_t *pattern);
|
28 | Pattern(cairo_surface_t *surface, repeat_type_t repeat);
|
29 | inline cairo_pattern_t *pattern(){ return _pattern; }
|
30 | private:
|
31 | ~Pattern();
|
32 | cairo_pattern_t *_pattern;
|
33 | repeat_type_t _repeat;
|
34 | };
|