synfig-core
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
modules
mod_geometry
circle.h
Go to the documentation of this file.
1
/* === S Y N F I G ========================================================= */
23
/* ========================================================================= */
24
25
/* === H E A D E R S ======================================================= */
26
27
#ifndef __SYNFIG_LAYER_CIRCLE_H__
28
#define __SYNFIG_LAYER_CIRCLE_H__
29
30
/* -- H E A D E R S --------------------------------------------------------- */
31
32
#include <
synfig/layers/layer_composite.h
>
33
#include <
synfig/color.h
>
34
#include <
synfig/vector.h
>
35
#include <
synfig/value.h
>
36
37
using namespace
synfig;
38
using namespace
std;
39
using namespace
etl;
40
41
/* -- M A C R O S ----------------------------------------------------------- */
42
43
/* -- T Y P E D E F S ------------------------------------------------------- */
44
45
/* -- S T R U C T S & C L A S S E S ----------------------------------------- */
46
47
class
Circle
:
public
synfig::Layer_Composite
,
public
synfig::Layer_NoDeform
48
{
49
SYNFIG_LAYER_MODULE_EXT
50
private
:
52
ValueBase
param_color;
54
ValueBase
param_origin;
56
ValueBase
param_radius;
58
ValueBase
param_feather;
60
ValueBase
param_invert;
62
ValueBase
param_falloff;
63
64
//Caching system for circle
65
struct
CircleDataCache
66
{
67
Real
inner_radius;
68
Real
outer_radius;
69
70
Real
inner_radius_sqd;
71
Real
outer_radius_sqd;
72
73
Real
diff_sqd;
74
Real
double_feather;
75
};
76
77
typedef
Real
FALLOFF_FUNC(
const
CircleDataCache &c,
const
Real
&mag_sqd);
78
79
FALLOFF_FUNC *falloff_func;
80
CircleDataCache cache;
81
82
void
constructcache();
83
84
static
Real
SqdFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
85
static
Real
InvSqdFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
86
static
Real
SqrtFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
87
static
Real
InvSqrtFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
88
static
Real
LinearFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
89
static
Real
InvLinearFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
90
static
Real
SigmondFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
91
static
Real
InvSigmondFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
92
static
Real
CosineFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
93
static
Real
InvCosineFalloff(
const
CircleDataCache &c,
const
Real
&mag_sqd);
94
95
FALLOFF_FUNC *GetFalloffFunc()
const
;
96
bool
ImportParameters(
const
String
¶m,
const
ValueBase
&value);
97
98
public
:
99
enum
Falloff
100
{
101
FALLOFF_SQUARED =0,
102
FALLOFF_INTERPOLATION_LINEAR =1,
103
FALLOFF_SMOOTH =2,
104
FALLOFF_COSINE =2,
105
FALLOFF_SIGMOND =3,
106
FALLOFF_SQRT =4
107
};
108
109
Circle
();
110
111
virtual
bool
set_param(
const
String
¶m,
const
ValueBase
&value);
112
113
virtual
ValueBase
get_param(
const
String
¶m)
const
;
114
115
virtual
Color
get_color(
Context
context,
const
Point
&pos)
const
;
116
117
virtual
bool
accelerated_render(
Context
context,
Surface
*surface,
int
quality,
const
RendDesc
&renddesc,
ProgressCallback
*cb)
const
;
118
virtual
bool
accelerated_cairorender(
Context
context,cairo_t *cr,
int
quality,
const
RendDesc
&renddesc,
ProgressCallback
*cb)
const
;
119
120
virtual
synfig::Rect
get_full_bounding_rect(
synfig::Context
context)
const
;
121
virtual
synfig::Rect
get_bounding_rect()
const
;
122
123
synfig::Layer::Handle
hit_check(
synfig::Context
context,
const
synfig::Point
&point)
const
;
124
125
virtual
Vocab get_param_vocab()
const
;
126
void
compile_gradient(cairo_pattern_t* gradient, CircleDataCache cache, FALLOFF_FUNC *func)
const
;
127
};
128
129
/* -- E X T E R N S --------------------------------------------------------- */
130
131
132
/* -- E N D ----------------------------------------------------------------- */
133
134
#endif
Generated on Mon Nov 16 2015 15:33:38 for synfig-core by
1.8.1.2