Added README.md
[dyncnn.git] / canvas_cairo.h
1
2 /*
3  *  dyncnn is a deep-learning algorithm for the prediction of
4  *  interacting object dynamics
5  *
6  *  Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
7  *  Written by Francois Fleuret <francois.fleuret@idiap.ch>
8  *
9  *  This file is part of dyncnn.
10  *
11  *  dyncnn is free software: you can redistribute it and/or modify it
12  *  under the terms of the GNU General Public License version 3 as
13  *  published by the Free Software Foundation.
14  *
15  *  dyncnn is distributed in the hope that it will be useful, but
16  *  WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *  General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with dyncnn.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef CANVAS_CAIRO_H
26 #define CANVAS_CAIRO_H
27
28 #include "canvas.h"
29
30 #include <stdio.h>
31 #include <cairo.h>
32
33 class CanvasCairo : public Canvas {
34   const static int _depth = 4;
35   int _actual_width, _actual_height;
36   scalar_t _scale;
37   unsigned char *_data;
38   cairo_surface_t *_image;
39   cairo_t *_context_resource;
40
41 public:
42   CanvasCairo(scalar_t scale, int nb_rows, int nb_cols, CanvasCairo **ca);
43   CanvasCairo(scalar_t scale, int width, int height);
44   CanvasCairo(int nb_rows, int nb_cols, CanvasCairo **x);
45
46   virtual ~CanvasCairo();
47
48   virtual void clear();
49   virtual void set_line_width(scalar_t w);
50   virtual void set_drawing_color(scalar_t r, scalar_t g, scalar_t b);
51   virtual void draw_polygon(int filled, int nb, scalar_t *x, scalar_t *y);
52   virtual void write_png(FILE *file);
53 };
54
55 #endif