Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / stable / src / synfig / blur.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file synfig/blur.h
3 **      \brief Blur Helper Header file
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but 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 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_BLUR_HELPER_H
26 #define __SYNFIG_BLUR_HELPER_H
27
28 /* === H E A D E R S ======================================================= */
29 #include <synfig/surface.h>
30 #include <synfig/color.h>
31 #include <synfig/vector.h>
32
33 /* === M A C R O S ========================================================= */
34
35 /* === T Y P E D E F S ===================================================== */
36
37 /* === C L A S S E S & S T R U C T S ======================================= */
38 namespace synfig {
39         class ProgressCallback;
40 }
41
42 class Blur
43 {
44 public:
45         enum Type
46         {
47                 BOX                             =0,
48                 FASTGAUSSIAN    =1,
49                 CROSS                   =2,
50                 GAUSSIAN                =3,
51                 DISC                    =4,
52
53                 FORCE_DWORD = 0x8fffffff
54         };
55
56 private:
57         synfig::Point   size;
58         int                             type;
59
60         synfig::ProgressCallback *cb;
61
62 public:
63         synfig::Point & set_size(const synfig::Point &v) { return (size = v); }
64         const synfig::Point & get_size() const { return size; }
65         synfig::Point & get_size() { return size; }
66
67         int & set_type(const int &t) { return (type = t); }
68         const int & get_type() const { return type; }
69         int & get_type() { return type; }
70
71         Blur() {}
72         Blur(const synfig::Point &s, int t, synfig::ProgressCallback *callb=0):size(s), type(t), cb(callb) {}
73         Blur(synfig::Real sx, synfig::Real sy, int t, synfig::ProgressCallback *callb = 0): size(sx,sy), type(t), cb(callb) {}
74
75         //Parametric Blur
76         synfig::Point operator()(const synfig::Point &p) const;
77         synfig::Point operator()(synfig::Real x, synfig::Real y) const;
78
79         //Surface based blur
80         //      input surface can be the same as output surface,
81         //      though both have to be the same size
82         bool operator()(const synfig::Surface &surface, const synfig::Vector &resolution, synfig::Surface &out) const;
83
84         bool operator()(const etl::surface<float> &surface, const synfig::Vector &resolution, etl::surface<float> &out) const;
85         //bool operator()(const etl::surface<unsigned char> &surface, const synfig::Vector &resolution, etl::surface<unsigned char> &out) const;
86 };
87
88 /* === E N D =============================================================== */
89
90 #endif