projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Shortcut color blending in get_color() when blend method is 'straight' and amount...
[synfig.git]
/
synfig-core
/
trunk
/
src
/
modules
/
example
/
metaballs.cpp
diff --git
a/synfig-core/trunk/src/modules/example/metaballs.cpp
b/synfig-core/trunk/src/modules/example/metaballs.cpp
index
9d55518
..
b365ea5
100644
(file)
--- a/
synfig-core/trunk/src/modules/example/metaballs.cpp
+++ b/
synfig-core/trunk/src/modules/example/metaballs.cpp
@@
-54,7
+54,7
@@
using namespace synfig;
SYNFIG_LAYER_INIT(Metaballs);
SYNFIG_LAYER_SET_NAME(Metaballs,"metaballs");
SYNFIG_LAYER_SET_LOCAL_NAME(Metaballs,N_("Metaballs"));
SYNFIG_LAYER_INIT(Metaballs);
SYNFIG_LAYER_SET_NAME(Metaballs,"metaballs");
SYNFIG_LAYER_SET_LOCAL_NAME(Metaballs,N_("Metaballs"));
-SYNFIG_LAYER_SET_CATEGORY(Metaballs,N_("
Default
"));
+SYNFIG_LAYER_SET_CATEGORY(Metaballs,N_("
Example
"));
SYNFIG_LAYER_SET_VERSION(Metaballs,"0.1");
SYNFIG_LAYER_SET_CVS_ID(Metaballs,"$Id$");
SYNFIG_LAYER_SET_VERSION(Metaballs,"0.1");
SYNFIG_LAYER_SET_CVS_ID(Metaballs,"$Id$");
@@
-68,6
+68,9
@@
Metaballs::Metaballs():
Layer_Composite(1.0,Color::BLEND_STRAIGHT),
color(Color::black())
{
Layer_Composite(1.0,Color::BLEND_STRAIGHT),
color(Color::black())
{
+ centers.push_back(Point( 0, -1.5)); radii.push_back(2.5); weights.push_back(1);
+ centers.push_back(Point(-2, 1)); radii.push_back(2.5); weights.push_back(1);
+ centers.push_back(Point( 2, 1)); radii.push_back(2.5); weights.push_back(1);
}
bool
}
bool
@@
-175,7
+178,12
@@
Color
Metaballs::get_color(Context context, const Point &pos)const
{
if (totaldensity(pos) >= threshold)
Metaballs::get_color(Context context, const Point &pos)const
{
if (totaldensity(pos) >= threshold)
- return color;
+ {
+ if(get_amount()==1.0 && get_blend_method()==Color::BLEND_STRAIGHT)
+ return color;
+ else
+ return Color::blend(color,context.get_color(pos),get_amount(),get_blend_method());
+ }
else
return context.get_color(pos);
}
else
return context.get_color(pos);
}