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-16 17:46:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-16 17:46:20 +0400
commit265262a5d5e56005d4636dc28f9fce25f4bbed57 (patch)
treefd055de04c8cbcba9fd5bb5a4f200d191547adcb /source/blender/compositor/nodes/COM_DilateErodeNode.cpp
parent2f29f8d18656e9c8796b68671a60812d0cffcb70 (diff)
feather option for dilate/erode node - needed for alpha masks so we can (blur in/out), currently only positive values supported.
Diffstat (limited to 'source/blender/compositor/nodes/COM_DilateErodeNode.cpp')
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index 6ee5b2a2b0d..6584120bc75 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -25,6 +25,8 @@
#include "COM_ExecutionSystem.h"
#include "COM_DilateErodeOperation.h"
#include "COM_AntiAliasOperation.h"
+#include "COM_GaussianAlphaXBlurOperation.h"
+#include "COM_GaussianAlphaYBlurOperation.h"
#include "BLI_math.h"
DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode)
@@ -70,6 +72,53 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
graph->addOperation(operation);
}
}
+ else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) {
+ /* this uses a modified gaussian blur function otherwise its far too slow */
+ if (editorNode->custom2 > 0) {
+
+ CompositorQuality quality = context->getQuality();
+
+ /* initialize node data */
+ NodeBlurData *data = (NodeBlurData *)&this->alpha_blur;
+ memset(data, 0, sizeof(*data));
+ data->sizex = data->sizey = editorNode->custom2;
+ data->filtertype = R_FILTER_GAUSS;
+
+ GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
+ operationx->setData(data);
+ operationx->setQuality(quality);
+ this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
+ this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph);
+ graph->addOperation(operationx);
+ GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
+ operationy->setData(data);
+ operationy->setQuality(quality);
+ this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
+ graph->addOperation(operationy);
+ addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
+ addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
+ addPreviewOperation(graph, operationy->getOutputSocket());
+
+ /* TODO? */
+ /* see gaussian blue node for original usage */
+#if 0
+ if (!connectedSizeSocket) {
+ operationx->setSize(size);
+ operationy->setSize(size);
+ }
+#else
+ operationx->setSize(1.0f);
+ operationy->setSize(1.0f);
+#endif
+ }
+ else {
+ ErodeDistanceOperation *operation = new ErodeDistanceOperation();
+ operation->setDistance(-editorNode->custom2);
+ this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+ this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ }
+ }
else {
if (editorNode->custom2 > 0) {
DilateStepOperation *operation = new DilateStepOperation();