UNPKG

902 Btext/x-cView Raw
1// Copyright (c) 2011 LearnBoost <tj@learnboost.com>
2
3#pragma once
4
5#include <cairo.h>
6#include <nan.h>
7#include <v8.h>
8
9/*
10 * Canvas types.
11 */
12
13typedef enum {
14 NO_REPEAT, // match CAIRO_EXTEND_NONE
15 REPEAT, // match CAIRO_EXTEND_REPEAT
16 REPEAT_X, // needs custom processing
17 REPEAT_Y // needs custom processing
18} repeat_type_t;
19
20extern const cairo_user_data_key_t *pattern_repeat_key;
21
22class 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};