moreupdates
[synfig.git] / synfig-core / trunk / src / synfig / blur.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file blur.h
3 **      \brief Blur Helper Header file
4 **
5 **      $Id: blur.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_BLUR_HELPER_H
25 #define __SYNFIG_BLUR_HELPER_H
26
27 /* === H E A D E R S ======================================================= */
28 #include <synfig/surface.h>
29 #include <synfig/color.h>
30 #include <synfig/vector.h>
31
32 /* === M A C R O S ========================================================= */
33
34 /* === T Y P E D E F S ===================================================== */
35
36 /* === C L A S S E S & S T R U C T S ======================================= */
37 class synfig::ProgressCallback;
38         
39 class Blur
40 {
41 public:
42         enum Type
43         {
44                 BOX                             =0,
45                 FASTGAUSSIAN    =1,
46                 CROSS                   =2,
47                 GAUSSIAN                =3,
48                 DISC                    =4,
49                 
50                 FORCE_DWORD = 0x8fffffff
51         };
52
53 private:
54         synfig::Point   size;
55         int                             type;
56
57         synfig::ProgressCallback *cb;
58
59 public:
60         synfig::Point & set_size(const synfig::Point &v) { return (size = v); }
61         const synfig::Point & get_size() const { return size; }
62         synfig::Point & get_size() { return size; }
63         
64         int & set_type(const int &t) { return (type = t); }
65         const int & get_type() const { return type; }
66         int & get_type() { return type; }
67         
68         Blur() {}
69         Blur(const synfig::Point &s, int t, synfig::ProgressCallback *callb=0):size(s), type(t), cb(callb) {}
70         Blur(synfig::Real sx, synfig::Real sy, int t, synfig::ProgressCallback *callb = 0): size(sx,sy), type(t), cb(callb) {}
71         
72         //Parametric Blur
73         synfig::Point operator ()(const synfig::Point &p) const;
74         synfig::Point operator ()(synfig::Real x, synfig::Real y) const;
75         
76         //Surface based blur
77         //      input surface can be the same as output surface,
78         //      though both have to be the same size
79         bool operator ()(const synfig::Surface &surface, const synfig::Vector &resolution, synfig::Surface &out) const;
80                 
81         bool operator ()(const etl::surface<float> &surface, const synfig::Vector &resolution, etl::surface<float> &out) const;
82         //bool operator ()(const etl::surface<unsigned char> &surface, const synfig::Vector &resolution, etl::surface<unsigned char> &out) const;
83 };
84
85 /* === E N D =============================================================== */
86
87 #endif