synfig-core
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
synfig
color.h
Go to the documentation of this file.
1
/* === S Y N F I G ========================================================= */
24
/* ========================================================================= */
25
26
#ifndef __SYNFIG_COLOR_H
27
#define __SYNFIG_COLOR_H
28
29
/* === H E A D E R S ======================================================= */
30
31
#include <
synfig/color/common.h
>
32
#include <
synfig/color/color.h
>
33
#include <
synfig/color/cairocolor.h
>
34
#include <
synfig/color/cairocoloraccumulator.h
>
35
36
namespace
synfig {
37
38
inline
Color::Color
(
const
CairoColor
& c)
39
{
40
float
div=1.0/((float)(
CairoColor::ceil
-
CairoColor::floor
));
41
set_r
((
ceil
-
floor
)*c.
get_r
()*div);
42
set_g
((
ceil
-
floor
)*c.
get_g
()*div);
43
set_b
((
ceil
-
floor
)*c.
get_b
()*div);
44
set_a
((
ceil
-
floor
)*c.
get_a
()*div);
45
}
46
47
48
inline
CairoColor::CairoColor
(
const
CairoColorAccumulator
& c)
49
{
50
set_a
(
CairoColor::clamp
(c.a_*
CairoColor::range
));
51
set_r
(
CairoColor::clamp
(c.r_*
CairoColor::range
));
52
set_g
(
CairoColor::clamp
(c.g_*
CairoColor::range
));
53
set_b
(
CairoColor::clamp
(c.b_*
CairoColor::range
));
54
}
55
56
}
57
58
#ifdef USE_HALF_TYPE
59
#include <
synfig/color/coloraccumulator.h
>
60
61
namespace
synfig {
62
inline
Color::Color
(
const
ColorAccumulator
& c):
63
a_(c.a_),
64
r_(c.r_),
65
g_(c.g_),
66
b_(c.b_) { }
67
}
68
#else
69
namespace
synfig {
70
typedef
Color
ColorAccumulator
;
71
}
72
#endif
73
74
#include <
synfig/color/pixelformat.h
>
75
76
#endif // __SYNFIG_COLOR_H
77
Generated on Mon Nov 16 2015 15:33:38 for synfig-core by
1.8.1.2