@brief ctor */
| 598 | |
| 599 | /** @brief ctor */ |
| 600 | QuantizePlugin(OfxImageEffectHandle handle) |
| 601 | : ImageEffect(handle) |
| 602 | , _dstClip(NULL) |
| 603 | , _srcClip(NULL) |
| 604 | , _maskClip(NULL) |
| 605 | , _processR(NULL) |
| 606 | , _processG(NULL) |
| 607 | , _processB(NULL) |
| 608 | , _processA(NULL) |
| 609 | , _colors(NULL) |
| 610 | , _premult(NULL) |
| 611 | , _premultChannel(NULL) |
| 612 | , _mix(NULL) |
| 613 | , _maskApply(NULL) |
| 614 | , _maskInvert(NULL) |
| 615 | { |
| 616 | |
| 617 | _dstClip = fetchClip(kOfxImageEffectOutputClipName); |
| 618 | assert( _dstClip && (_dstClip->getPixelComponents() == ePixelComponentRGB || |
| 619 | _dstClip->getPixelComponents() == ePixelComponentRGBA || |
| 620 | _dstClip->getPixelComponents() == ePixelComponentAlpha) ); |
| 621 | _srcClip = getContext() == eContextGenerator ? NULL : fetchClip(kOfxImageEffectSimpleSourceClipName); |
| 622 | assert( (!_srcClip && getContext() == eContextGenerator) || |
| 623 | ( _srcClip && (_srcClip->getPixelComponents() == ePixelComponentRGB || |
| 624 | _srcClip->getPixelComponents() == ePixelComponentRGBA || |
| 625 | _srcClip->getPixelComponents() == ePixelComponentAlpha) ) ); |
| 626 | _maskClip = fetchClip(getContext() == eContextPaint ? "Brush" : "Mask"); |
| 627 | assert(!_maskClip || _maskClip->getPixelComponents() == ePixelComponentAlpha); |
| 628 | |
| 629 | // TODO: fetch noise parameters |
| 630 | |
| 631 | _premult = fetchBooleanParam(kParamPremult); |
| 632 | _premultChannel = fetchChoiceParam(kParamPremultChannel); |
| 633 | assert(_premult && _premultChannel); |
| 634 | _mix = fetchDoubleParam(kParamMix); |
| 635 | _maskApply = ( ofxsMaskIsAlwaysConnected( OFX::getImageEffectHostDescription() ) && paramExists(kParamMaskApply) ) ? fetchBooleanParam(kParamMaskApply) : 0; |
| 636 | _maskInvert = fetchBooleanParam(kParamMaskInvert); |
| 637 | assert(_mix && _maskInvert); |
| 638 | |
| 639 | _processR = fetchBooleanParam(kParamProcessR); |
| 640 | _processG = fetchBooleanParam(kParamProcessG); |
| 641 | _processB = fetchBooleanParam(kParamProcessB); |
| 642 | _processA = fetchBooleanParam(kParamProcessA); |
| 643 | assert(_processR && _processG && _processB && _processA); |
| 644 | |
| 645 | _colors = fetchDoubleParam(kParamColors); |
| 646 | _dither = fetchChoiceParam(kParamDither); |
| 647 | _seed = fetchIntParam(kParamSeed); |
| 648 | _staticSeed = fetchBooleanParam(kParamStaticSeed); |
| 649 | assert(_colors && _dither && _seed && _staticSeed); |
| 650 | } |
| 651 | |
| 652 | private: |
| 653 | /* Override the render */ |
nothing calls this directly
no test coverage detected