@brief ctor */
| 585 | public: |
| 586 | /** @brief ctor */ |
| 587 | KeyerPlugin(OfxImageEffectHandle handle) |
| 588 | : ImageEffect(handle) |
| 589 | , _dstClip(NULL) |
| 590 | , _srcClip(NULL) |
| 591 | , _bgClip(NULL) |
| 592 | , _inMaskClip(NULL) |
| 593 | , _outMaskClip(NULL) |
| 594 | , _sublabel(NULL) |
| 595 | , _keyColor(NULL) |
| 596 | , _keyerMode(NULL) |
| 597 | , _luminanceMath(NULL) |
| 598 | , _softnessLower(NULL) |
| 599 | , _toleranceLower(NULL) |
| 600 | , _center(NULL) |
| 601 | , _toleranceUpper(NULL) |
| 602 | , _softnessUpper(NULL) |
| 603 | , _despill(NULL) |
| 604 | , _despillAngle(NULL) |
| 605 | , _outputMode(NULL) |
| 606 | , _sourceAlpha(NULL) |
| 607 | { |
| 608 | |
| 609 | _dstClip = fetchClip(kOfxImageEffectOutputClipName); |
| 610 | assert( _dstClip && (!_dstClip->isConnected() || _dstClip->getPixelComponents() == ePixelComponentRGBA) ); |
| 611 | _srcClip = getContext() == eContextGenerator ? NULL : fetchClip(kOfxImageEffectSimpleSourceClipName); |
| 612 | assert( (!_srcClip && getContext() == eContextGenerator) || |
| 613 | ( _srcClip && (!_srcClip->isConnected() || _srcClip->getPixelComponents() == ePixelComponentRGB || |
| 614 | _srcClip->getPixelComponents() == ePixelComponentRGBA) ) ); |
| 615 | _bgClip = fetchClip(kClipBg); |
| 616 | assert( _bgClip && (!_bgClip->isConnected() || _bgClip->getPixelComponents() == ePixelComponentRGB || _bgClip->getPixelComponents() == ePixelComponentRGBA) ); |
| 617 | _inMaskClip = fetchClip(kClipInsideMask);; |
| 618 | assert( _inMaskClip && (!_inMaskClip->isConnected() || _inMaskClip->getPixelComponents() == ePixelComponentAlpha) ); |
| 619 | _outMaskClip = fetchClip(kClipOutsidemask);; |
| 620 | assert( _outMaskClip && (!_outMaskClip->isConnected() || _outMaskClip->getPixelComponents() == ePixelComponentAlpha) ); |
| 621 | _sublabel = fetchStringParam(kNatronOfxParamStringSublabelName); |
| 622 | _keyColor = fetchRGBParam(kParamKeyColor); |
| 623 | _keyerMode = fetchChoiceParam(kParamKeyerMode); |
| 624 | _luminanceMath = fetchChoiceParam(kParamLuminanceMath); |
| 625 | _softnessLower = fetchDoubleParam(kParamSoftnessLower); |
| 626 | _toleranceLower = fetchDoubleParam(kParamToleranceLower); |
| 627 | _center = fetchDoubleParam(kParamCenter); |
| 628 | _toleranceUpper = fetchDoubleParam(kParamToleranceUpper); |
| 629 | _softnessUpper = fetchDoubleParam(kParamSoftnessUpper); |
| 630 | _despill = fetchDoubleParam(kParamDespill); |
| 631 | _despillAngle = fetchDoubleParam(kParamDespillAngle); |
| 632 | assert(_keyColor && _keyerMode && _luminanceMath && _softnessLower && _toleranceLower && _center && _toleranceUpper && _softnessUpper && _despill && _despillAngle); |
| 633 | _outputMode = fetchChoiceParam(kParamOutputMode); |
| 634 | _sourceAlpha = fetchChoiceParam(kParamSourceAlpha); |
| 635 | assert(_outputMode && _sourceAlpha); |
| 636 | |
| 637 | // finally |
| 638 | syncPrivateData(); |
| 639 | } |
| 640 | |
| 641 | private: |
| 642 | /* Override the render */ |
nothing calls this directly
no test coverage detected