Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_07 / 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 class synfig::ProgressCallback;
39
40 class Blur
41 {
42 public:
43         enum Type
44         {
45                 BOX                             =0,
46                 FASTGAUSSIAN    =1,
47                 CROSS                   =2,
48                 GAUSSIAN                =3,
49                 DISC                    =4,
50
51                 FORCE_DWORD = 0x8fffffff
52         };
53
54 private:
55         synfig::Point   size;
56         int                             type;
57
58         synfig::ProgressCallback *cb;
59
60 public:
61         synfig::Point & set_size(const synfig::Point &v) { return (size = v); }
62         const synfig::Point & get_size() const { return size; }
63         synfig::Point & get_size() { return size; }
64
65         int & set_type(const int &t) { return (type = t); }
66         const int & get_type() const { return type; }
67         int & get_type() { return type; }
68
69         Blur() {}
70         Blur(const synfig::Point &s, int t, synfig::ProgressCallback *callb=0):size(s), type(t), cb(callb) {}
71         Blur(synfig::Real sx, synfig::Real sy, int t, synfig::ProgressCallback *callb = 0): size(sx,sy), type(t), cb(callb) {}
72
73         //Parametric Blur
74         synfig::Point operator ()(const synfig::Point &p) const;
75         synfig::Point operator ()(synfig::Real x, synfig::Real y) const;
76
77         //Surface based blur
78         //      input surface can be the same as output surface,
79         //      though both have to be the same size
80         bool operator ()(const synfig::Surface &surface, const synfig::Vector &resolution, synfig::Surface &out) const;
81
82         bool operator ()(const etl::surface<float> &surface, const synfig::Vector &resolution, etl::surface<float> &out) const;
83         //bool operator ()(const etl::surface<unsigned char> &surface, const synfig::Vector &resolution, etl::surface<unsigned char> &out) const;
84 };
85
86 /* === E N D =============================================================== */
87
88 #endif