本文整理汇总了C++中OutputSocket::isConnected方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputSocket::isConnected方法的具体用法?C++ OutputSocket::isConnected怎么用?C++ OutputSocket::isConnected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputSocket
的用法示例。
在下文中一共展示了OutputSocket::isConnected方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToOperations
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocketImage = this->getInputSocket(0);
InputSocket *inputSocketKey = this->getInputSocket(1);
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
DistanceMatteOperation *operation = new DistanceMatteOperation();
bNode *editorsnode = getbNode();
operation->setSettings((NodeChroma *)editorsnode->storage);
inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
if (outputSocketMatte->isConnected()) {
outputSocketMatte->relinkConnections(operation->getOutputSocket());
}
graph->addOperation(operation);
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
addLink(graph, operation->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
addPreviewOperation(graph, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
}
}
示例2: convertToOperations
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocketImage = this->getInputSocket(0);
InputSocket *inputSocketKey = this->getInputSocket(1);
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
NodeOperation *operation;
bNode *editorsnode = getbNode();
NodeChroma *storage = (NodeChroma *)editorsnode->storage;
/* work in RGB color space */
if (storage->channel == 1) {
operation = new DistanceRGBMatteOperation();
((DistanceRGBMatteOperation *) operation)->setSettings(storage);
inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
}
/* work in YCbCr color space */
else {
operation = new DistanceYCCMatteOperation();
((DistanceYCCMatteOperation *) operation)->setSettings(storage);
ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation();
inputSocketImage->relinkConnections(operationYCCImage->getInputSocket(0), 0, graph);
addLink(graph, operationYCCImage->getOutputSocket(), operation->getInputSocket(0));
graph->addOperation(operationYCCImage);
ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation();
inputSocketKey->relinkConnections(operationYCCMatte->getInputSocket(0), 1, graph);
addLink(graph, operationYCCMatte->getOutputSocket(), operation->getInputSocket(1));
graph->addOperation(operationYCCMatte);
}
if (outputSocketMatte->isConnected()) {
outputSocketMatte->relinkConnections(operation->getOutputSocket());
}
graph->addOperation(operation);
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
addLink(graph, operation->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
}
}
示例3: testSocketConnection
void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation)
{
OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
Scene *scene = (Scene *)this->getbNode()->id;
short layerId = this->getbNode()->custom1;
if (outputSocket->isConnected()) {
operation->setScene(scene);
operation->setLayerId(layerId);
operation->setRenderData(context->getRenderData());
outputSocket->relinkConnections(operation->getOutputSocket());
system->addOperation(operation);
if (outputSocketNumber == 0) { // only do for image socket if connected
addPreviewOperation(system, context, operation->getOutputSocket());
}
}
else {
if (outputSocketNumber == 0) {
system->addOperation(operation);
operation->setScene(scene);
operation->setLayerId(layerId);
operation->setRenderData(context->getRenderData());
addPreviewOperation(system, context, operation->getOutputSocket());
}
else {
delete operation;
}
}
}
示例4: convertToOperations
void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
vector<OutputSocket *> &outputsockets = this->getOutputSockets();
for (unsigned int index = 0; index < outputsockets.size(); index++) {
OutputSocket *output = outputsockets[index];
if (output->isConnected()) {
reconnect(graph, output);
}
}
}
示例5: convertToOperations
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocketImage = this->getInputSocket(0);
InputSocket *inputSocketKey = this->getInputSocket(1);
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation();
ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation();
operationRGBToYCC_Image->setMode(0); /* BLI_YCC_ITU_BT601 */
operationRGBToYCC_Key->setMode(0); /* BLI_YCC_ITU_BT601 */
ChromaMatteOperation *operation = new ChromaMatteOperation();
bNode *editorsnode = getbNode();
operation->setSettings((NodeChroma *)editorsnode->storage);
inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 0, graph);
addLink(graph, operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0));
addLink(graph, operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1));
graph->addOperation(operationRGBToYCC_Image);
graph->addOperation(operationRGBToYCC_Key);
graph->addOperation(operation);
if (outputSocketMatte->isConnected()) {
outputSocketMatte->relinkConnections(operation->getOutputSocket());
}
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
addLink(graph, operationRGBToYCC_Image->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
}
}
示例6: convertToOperations
void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *imageSocket = this->getInputSocket(0);
OutputSocket *outputRSocket = this->getOutputSocket(0);
OutputSocket *outputGSocket = this->getOutputSocket(1);
OutputSocket *outputBSocket = this->getOutputSocket(2);
OutputSocket *outputASocket = this->getOutputSocket(3);
if (outputRSocket->isConnected()) {
SeparateChannelOperation *operation = new SeparateChannelOperation();
operation->setChannel(0);
imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
outputRSocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
if (outputGSocket->isConnected()) {
SeparateChannelOperation *operation = new SeparateChannelOperation();
operation->setChannel(1);
imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
outputGSocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
if (outputBSocket->isConnected()) {
SeparateChannelOperation *operation = new SeparateChannelOperation();
operation->setChannel(2);
imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
outputBSocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
if (outputASocket->isConnected()) {
SeparateChannelOperation *operation = new SeparateChannelOperation();
operation->setChannel(3);
imageSocket->relinkConnectionsDuplicate(operation->getInputSocket(0), 0, graph);
outputASocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
/* remove the original connection to the node, this has been duplicated for all operations */
imageSocket->unlinkConnections(graph);
}
示例7: convertToOperations
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *node = this->getbNode();
operation->setMode(node->custom1);
if (outputSocket->isConnected()) {
outputSocket->relinkConnections(operation->getOutputSocket());
addLink(graph, outputSocket, operation->getInputSocket(0));
}
graph->addOperation(operation);
CombineRGBANode::convertToOperations(graph, context);
}
示例8: convertToOperations
void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
OutputSocket *outputsocket = this->getOutputSocket(0);
InputSocket *inputsocket = this->getInputSocket(0);
if (outputsocket->isConnected()) {
if (inputsocket->isConnected()) {
SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType());
inputsocket->relinkConnections(operation->getInputSocket(0));
outputsocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
else {
/* If input is not connected, add a constant value operation instead */
switch (outputsocket->getDataType()) {
case COM_DT_VALUE:
{
SetValueOperation *operation = new SetValueOperation();
bNodeSocketValueFloat *dval = (bNodeSocketValueFloat *)inputsocket->getbNodeSocket()->default_value;
operation->setValue(dval->value);
outputsocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
break;
}
case COM_DT_COLOR:
{
SetColorOperation *operation = new SetColorOperation();
bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA *)inputsocket->getbNodeSocket()->default_value;
operation->setChannels(dval->value);
outputsocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
break;
}
case COM_DT_VECTOR:
{
SetVectorOperation *operation = new SetVectorOperation();
bNodeSocketValueVector *dval = (bNodeSocketValueVector *)inputsocket->getbNodeSocket()->default_value;
operation->setVector(dval->value);
outputsocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
break;
}
}
}
}
}
示例9: convertToOperations
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/// Image output
OutputSocket *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
Image *image = (Image *)editorNode->id;
ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
OutputSocket *socket;
int index;
is_multilayer_ok = true;
for (index = 0; index < numberOfOutputs; index++) {
NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;
int passindex = storage->pass_index;
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
if (rpass) {
imageuser->pass = passindex;
switch (rpass->channels) {
case 1:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
break;
/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
/* XXX any way to detect actual vector images? */
case 3:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
break;
case 4:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
break;
default:
/* dummy operation is added below */
break;
}
if (index == 0 && operation) {
addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
/* incase we can't load the layer */
if (operation == NULL) {
convertToOperations_invalid_index(graph, index);
}
}
}
}
BKE_image_release_ibuf(image, ibuf, NULL);
/* without this, multilayer that fail to load will crash blender [#32490] */
if (is_multilayer_ok == false) {
convertToOperations_invalid(graph, context);
}
}
else {
if (numberOfOutputs > 0) {
ImageOperation *operation = new ImageOperation();
if (outputImage->isConnected()) {
outputImage->relinkConnections(operation->getOutputSocket());
}
operation->setImage(image);
operation->setImageUser(imageuser);
operation->setFramenumber(framenumber);
graph->addOperation(operation);
addPreviewOperation(graph, context, operation->getOutputSocket());
}
if (numberOfOutputs > 1) {
OutputSocket *alphaImage = this->getOutputSocket(1);
if (alphaImage->isConnected()) {
ImageAlphaOperation *alphaOperation = new ImageAlphaOperation();
alphaOperation->setImage(image);
alphaOperation->setImageUser(imageuser);
alphaOperation->setFramenumber(framenumber);
alphaImage->relinkConnections(alphaOperation->getOutputSocket());
graph->addOperation(alphaOperation);
}
}
if (numberOfOutputs > 2) {
OutputSocket *depthImage = this->getOutputSocket(2);
if (depthImage->isConnected()) {
ImageDepthOperation *depthOperation = new ImageDepthOperation();
depthOperation->setImage(image);
//.........这里部分代码省略.........
示例10: convertToOperations
void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
OutputSocket *outputMovieClip = this->getOutputSocket(0);
OutputSocket *alphaMovieClip = this->getOutputSocket(1);
OutputSocket *offsetXMovieClip = this->getOutputSocket(2);
OutputSocket *offsetYMovieClip = this->getOutputSocket(3);
OutputSocket *scaleMovieClip = this->getOutputSocket(4);
OutputSocket *angleMovieClip = this->getOutputSocket(5);
bNode *editorNode = this->getbNode();
MovieClip *movieClip = (MovieClip *)editorNode->id;
MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage;
bool cacheFrame = !context->isRendering();
ImBuf *ibuf = NULL;
if (movieClip) {
if (cacheFrame)
ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser);
else
ibuf = BKE_movieclip_get_ibuf_flag(movieClip, movieClipUser, movieClip->flag, MOVIECLIP_CACHE_SKIP);
}
// always connect the output image
MovieClipOperation *operation = new MovieClipOperation();
addPreviewOperation(graph, context, operation->getOutputSocket());
if (outputMovieClip->isConnected()) {
outputMovieClip->relinkConnections(operation->getOutputSocket());
}
operation->setMovieClip(movieClip);
operation->setMovieClipUser(movieClipUser);
operation->setFramenumber(context->getFramenumber());
operation->setCacheFrame(cacheFrame);
graph->addOperation(operation);
if (alphaMovieClip->isConnected()) {
MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation();
alphaOperation->setMovieClip(movieClip);
alphaOperation->setMovieClipUser(movieClipUser);
alphaOperation->setFramenumber(context->getFramenumber());
alphaOperation->setCacheFrame(cacheFrame);
alphaMovieClip->relinkConnections(alphaOperation->getOutputSocket());
graph->addOperation(alphaOperation);
}
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
float loc[2], scale, angle;
loc[0] = 0.0f;
loc[1] = 0.0f;
scale = 1.0f;
angle = 0.0f;
if (ibuf) {
if (stab->flag & TRACKING_2D_STABILIZATION) {
int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context->getFramenumber());
BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle);
}
}
if (offsetXMovieClip->isConnected()) {
SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(loc[0]);
offsetXMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (offsetYMovieClip->isConnected()) {
SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(loc[1]);
offsetYMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (scaleMovieClip->isConnected()) {
SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(scale);
scaleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (angleMovieClip->isConnected()) {
SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(angle);
angleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (ibuf) {
IMB_freeImBuf(ibuf);
}
}
示例11: convertToOperations
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/// Image output
OutputSocket *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
Image *image = (Image *)editorNode->id;
ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
OutputSocket *socket;
int index;
is_multilayer_ok = true;
for (index = 0; index < numberOfOutputs; index++) {
NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
/* Passes in the file can differ from passes stored in sockets (#36755).
* Look up the correct file pass using the socket identifier instead.
*/
#if 0
NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/
int passindex = storage->pass_index;*/
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
#endif
int passindex;
RenderPass *rpass;
for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex)
if (STREQ(rpass->name, bnodeSocket->identifier))
break;
if (rpass) {
imageuser->pass = passindex;
switch (rpass->channels) {
case 1:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
break;
/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
/* XXX any way to detect actual vector images? */
case 3:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
break;
case 4:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
break;
default:
/* dummy operation is added below */
break;
}
if (index == 0 && operation) {
addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
/* incase we can't load the layer */
if (operation == NULL) {
convertToOperations_invalid_index(graph, index);
}
}
}
示例12: convertToOperations
void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputImage = this->getInputSocket(0);
InputSocket *inputScreen = this->getInputSocket(1);
InputSocket *inputGarbageMatte = this->getInputSocket(2);
InputSocket *inputCoreMatte = this->getInputSocket(3);
OutputSocket *outputImage = this->getOutputSocket(0);
OutputSocket *outputMatte = this->getOutputSocket(1);
OutputSocket *outputEdges = this->getOutputSocket(2);
OutputSocket *postprocessedMatte = NULL, *postprocessedImage = NULL, *originalImage = NULL, *edgesMatte = NULL;
bNode *editorNode = this->getbNode();
NodeKeyingData *keying_data = (NodeKeyingData *) editorNode->storage;
/* keying operation */
KeyingOperation *keyingOperation = new KeyingOperation();
keyingOperation->setScreenBalance(keying_data->screen_balance);
inputScreen->relinkConnections(keyingOperation->getInputSocket(1), 1, graph);
if (keying_data->blur_pre) {
/* chroma preblur operation for input of keying operation */
OutputSocket *preBluredImage = setupPreBlur(graph, inputImage, keying_data->blur_pre, &originalImage);
addLink(graph, preBluredImage, keyingOperation->getInputSocket(0));
}
else {
inputImage->relinkConnections(keyingOperation->getInputSocket(0), 0, graph);
originalImage = keyingOperation->getInputSocket(0)->getConnection()->getFromSocket();
}
graph->addOperation(keyingOperation);
postprocessedMatte = keyingOperation->getOutputSocket();
/* black / white clipping */
if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) {
postprocessedMatte = setupClip(graph, postprocessedMatte,
keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance,
keying_data->clip_black, keying_data->clip_white, false);
}
/* output edge matte */
if (outputEdges->isConnected()) {
edgesMatte = setupClip(graph, postprocessedMatte,
keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance,
keying_data->clip_black, keying_data->clip_white, true);
}
/* apply garbage matte */
if (inputGarbageMatte->isConnected()) {
SetValueOperation *valueOperation = new SetValueOperation();
MathSubtractOperation *subtractOperation = new MathSubtractOperation();
MathMinimumOperation *minOperation = new MathMinimumOperation();
valueOperation->setValue(1.0f);
addLink(graph, valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0));
inputGarbageMatte->relinkConnections(subtractOperation->getInputSocket(1), 0, graph);
addLink(graph, subtractOperation->getOutputSocket(), minOperation->getInputSocket(0));
addLink(graph, postprocessedMatte, minOperation->getInputSocket(1));
postprocessedMatte = minOperation->getOutputSocket();
graph->addOperation(valueOperation);
graph->addOperation(subtractOperation);
graph->addOperation(minOperation);
}
/* apply core matte */
if (inputCoreMatte->isConnected()) {
MathMaximumOperation *maxOperation = new MathMaximumOperation();
inputCoreMatte->relinkConnections(maxOperation->getInputSocket(0), 0, graph);
addLink(graph, postprocessedMatte, maxOperation->getInputSocket(1));
postprocessedMatte = maxOperation->getOutputSocket();
graph->addOperation(maxOperation);
}
/* apply blur on matte if needed */
if (keying_data->blur_post)
postprocessedMatte = setupPostBlur(graph, postprocessedMatte, keying_data->blur_post);
/* matte dilate/erode */
if (keying_data->dilate_distance != 0) {
postprocessedMatte = setupDilateErode(graph, postprocessedMatte, keying_data->dilate_distance);
}
/* matte feather */
if (keying_data->feather_distance != 0) {
postprocessedMatte = setupFeather(graph, context, postprocessedMatte, keying_data->feather_falloff,
keying_data->feather_distance);
}
/* set alpha channel to output image */
SetAlphaOperation *alphaOperation = new SetAlphaOperation();
//.........这里部分代码省略.........