summaryrefslogtreecommitdiff
path: root/src/cairo.hh
blob: a53cee94d4183341401babdc21a2d0a9d2c24adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CAIRO_HH
#define CAIRO_HH

#include <cairo-xcb.h>
#include <memory>

namespace cairo {

namespace priv {

struct CairoSurfaceDelete {
  void operator()(cairo_surface_t* surface) const {
    cairo_surface_destroy(surface);
  }
};

struct CairoDelete {
  void operator()(cairo_t* cairo) const {
    cairo_destroy(cairo);
  }
};

struct CairoPatternDelete {
  void operator()(cairo_pattern_t* pattern) const {
    cairo_pattern_destroy(pattern);
  }
};

struct CairoPathDelete {
  void operator()(cairo_path_t* path) const {
    cairo_path_destroy(path);
  }
};

}  // namespace priv

typedef std::unique_ptr<cairo_surface_t, priv::CairoSurfaceDelete>
    unique_surface;

typedef std::unique_ptr<cairo_path_t, priv::CairoPathDelete>
    unique_path;

typedef std::unique_ptr<cairo_pattern_t, priv::CairoPatternDelete>
    unique_pattern;

typedef std::unique_ptr<cairo_t, priv::CairoDelete> unique;

}  // namespace cairo

#endif  // CAIRO_HH