Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-21 11:45:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-21 11:45:41 +0400
commitfae0b2068b2287fdce76116ff5e0503040f5be61 (patch)
tree9e232485fe84e8261402ef26fa5ee66c23c78140 /source/blender/compositor/operations/COM_BlurBaseOperation.cpp
parent19e81b12e774d800cff8e5de7b450f65d108a451 (diff)
falloff options for dilate/erode feather compo node.
Diffstat (limited to 'source/blender/compositor/operations/COM_BlurBaseOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index a233c7a50ae..df64b7c8ddc 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -91,7 +91,7 @@ float *BlurBaseOperation::make_gausstab(int rad)
/* normalized distance from the current (inverted so 1.0 is close and 0.0 is far)
* 'ease' is applied after, looks nicer */
-float *BlurBaseOperation::make_dist_fac_inverse(int rad)
+float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff)
{
float *dist_fac_invert, val;
int i, n;
@@ -103,9 +103,26 @@ float *BlurBaseOperation::make_dist_fac_inverse(int rad)
for (i = -rad; i <= rad; i++) {
val = 1.0f - fabsf(((float)i / (float)rad));
- /* ease - gives less hard lines for dilate/erode feather */
- val = (3.0f * val * val - 2.0f * val * val * val);
-
+ /* keep in sync with proportional_falloff_curve_only_items */
+ switch (falloff) {
+ case PROP_SMOOTH:
+ /* ease - gives less hard lines for dilate/erode feather */
+ val = (3.0f * val * val - 2.0f * val * val * val);
+ break;
+ case PROP_SPHERE:
+ val = sqrtf(2.0f * val - val * val);
+ break;
+ case PROP_ROOT:
+ val = sqrtf(val);
+ break;
+ case PROP_SHARP:
+ val = val * val;
+ break;
+ case PROP_LIN:
+ default:
+ /* nothing */
+ break;
+ }
dist_fac_invert[i + rad] = val;
}