Ejemplo n.º 1
0
TextPlugin::TextPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
{
	_text          = fetchStringParam( kText );
	_font          = fetchStringParam( kFont );
	_size          = fetchIntParam( kSize );
	_ratio         = fetchDoubleParam( kRatio );
	_color         = fetchRGBAParam( kColor );
	_position      = fetchDouble2DParam( kPosition );
	_letterSpacing = fetchDoubleParam( kLetterSpacing );
	_verticalFlip  = fetchBooleanParam( kVerticalFlip );
}
Ejemplo n.º 2
0
TestOpenGLPlugin::TestOpenGLPlugin(OfxImageEffectHandle handle)
: ImageEffect(handle)
, _dstClip(0)
, _srcClip(0)
, _scale(0)
, _sourceScale(0)
, _sourceStretch(0)
, _teapotScale(0)
, _angleX(0)
, _angleY(0)
, _angleZ(0)
, _projective(0)
, _mipmap(0)
, _anisotropic(0)
, _useGPUIfAvailable(0)
, _haveAniso(false)
, _maxAnisoMax(1.)
{
    _dstClip = fetchClip(kOfxImageEffectOutputClipName);
    assert(_dstClip && (_dstClip->getPixelComponents() == OFX::ePixelComponentRGBA ||
                        _dstClip->getPixelComponents() == OFX::ePixelComponentAlpha));
    _srcClip = getContext() == OFX::eContextGenerator ? NULL : fetchClip(kOfxImageEffectSimpleSourceClipName);
    assert((!_srcClip && getContext() == OFX::eContextGenerator) ||
           (_srcClip && (_srcClip->getPixelComponents() == OFX::ePixelComponentRGBA ||
                         _srcClip->getPixelComponents() == OFX::ePixelComponentAlpha)));

    _scale = fetchDouble2DParam(kParamScale);
    _sourceScale = fetchDouble2DParam(kParamSourceScale);
    _sourceStretch = fetchDoubleParam(kParamSourceStretch);
    _teapotScale = fetchDoubleParam(kParamTeapotScale);
    assert(_scale && _sourceScale);
    _angleX = fetchDoubleParam(kParamAngleX);
    _angleY = fetchDoubleParam(kParamAngleY);
    _angleZ = fetchDoubleParam(kParamAngleZ);
    assert(_angleX && _angleY && _angleZ);
    _projective = fetchBooleanParam(kParamProjective);
    _mipmap = fetchBooleanParam(kParamMipmap);
    _anisotropic = fetchBooleanParam(kParamAnisotropic);
    assert(_projective && _mipmap && _anisotropic);
#if defined(OFX_SUPPORTS_OPENGLRENDER) && defined(HAVE_OSMESA)
    _useGPUIfAvailable = fetchBooleanParam(kParamUseGPU);
    assert(_useGPUIfAvailable);
    const OFX::ImageEffectHostDescription &gHostDescription = *OFX::getImageEffectHostDescription();
    if (!gHostDescription.supportsOpenGLRender) {
        _useGPUIfAvailable->setEnabled(false);
    }
#endif

}
Ejemplo n.º 3
0
CImgFilterPluginHelperBase::CImgFilterPluginHelperBase(OfxImageEffectHandle handle,
                                                       bool supportsComponentRemapping, // true if the number and order of components of the image passed to render() has no importance
                                                       bool supportsTiles,
                                                       bool supportsMultiResolution,
                                                       bool supportsRenderScale,
                                                       bool defaultUnpremult/* = true*/,
                                                       bool defaultProcessAlphaOnRGBA/* = false*/,
                                                       bool isFilter/* = true*/)
: ImageEffect(handle)
, _dstClip(0)
, _srcClip(0)
, _maskClip(0)
, _processR(0)
, _processG(0)
, _processB(0)
, _processA(0)
, _premult(0)
, _premultChannel(0)
, _mix(0)
, _maskApply(0)
, _maskInvert(0)
, _supportsComponentRemapping(supportsComponentRemapping)
, _supportsTiles(supportsTiles)
, _supportsMultiResolution(supportsMultiResolution)
, _supportsRenderScale(supportsRenderScale)
, _defaultUnpremult(defaultUnpremult)
, _defaultProcessAlphaOnRGBA(defaultProcessAlphaOnRGBA)
, _premultChanged(0)
{
    _dstClip = fetchClip(kOfxImageEffectOutputClipName);
    assert(_dstClip && (_dstClip->getPixelComponents() == OFX::ePixelComponentRGB ||
                        _dstClip->getPixelComponents() == OFX::ePixelComponentRGBA));
    if (isFilter) {
        _srcClip = getContext() == OFX::eContextGenerator ? NULL : fetchClip(kOfxImageEffectSimpleSourceClipName);
        assert((!_srcClip && getContext() == OFX::eContextGenerator) ||
               (_srcClip && (_srcClip->getPixelComponents() == OFX::ePixelComponentRGB ||
                             _srcClip->getPixelComponents() == OFX::ePixelComponentRGBA)));
        _maskClip = fetchClip(getContext() == OFX::eContextPaint ? "Brush" : "Mask");
        assert(!_maskClip || _maskClip->getPixelComponents() == OFX::ePixelComponentAlpha);
    }

    if (paramExists(kNatronOfxParamProcessR)) {
        _processR = fetchBooleanParam(kNatronOfxParamProcessR);
        _processG = fetchBooleanParam(kNatronOfxParamProcessG);
        _processB = fetchBooleanParam(kNatronOfxParamProcessB);
        _processA = fetchBooleanParam(kNatronOfxParamProcessA);
        assert(_processR && _processG && _processB && _processA);
    }
    _premult = fetchBooleanParam(kParamPremult);
    _premultChannel = fetchChoiceParam(kParamPremultChannel);
    assert(_premult && _premultChannel);
    _mix = fetchDoubleParam(kParamMix);
    _maskApply = paramExists(kParamMaskApply) ? fetchBooleanParam(kParamMaskApply) : 0;
    _maskInvert = fetchBooleanParam(kParamMaskInvert);
    assert(_mix && _maskInvert);
    _premultChanged = fetchBooleanParam(kParamPremultChanged);
    assert(_premultChanged);
}
Ejemplo n.º 4
0
MathOperatorPlugin::MathOperatorPlugin( OfxImageEffectHandle handle )
: ImageEffectGilPlugin( handle )
{
	_operator        = fetchChoiceParam( kMathOperatorOperator );
	_mathOperatorType   = fetchChoiceParam( kMathOperatorType );

	_master          = fetchDoubleParam( kMasterValue );
	_red             = fetchDoubleParam( kRedValue );
	_green           = fetchDoubleParam( kGreenValue );
	_blue            = fetchDoubleParam( kBlueValue );
	_alpha           = fetchDoubleParam( kAlphaValue );

	_redSelect       = fetchBooleanParam( kRedChannel );
	_greenSelect     = fetchBooleanParam( kGreenChannel );
	_blueSelect      = fetchBooleanParam( kBlueChannel );
	_alphaSelect     = fetchBooleanParam( kAlphaChannel );

	updateInterface();
}
Ejemplo n.º 5
0
 /** @brief ctor */
 CheckerBoardPlugin(OfxImageEffectHandle handle)
 : GeneratorPlugin(handle, true)
 , _boxSize(0)
 , _color0(0)
 , _color1(0)
 , _color2(0)
 , _color3(0)
 , _lineColor(0)
 , _lineWidth(0)
 , _centerlineColor(0)
 , _centerlineWidth(0)
 {
     _boxSize = fetchDouble2DParam(kParamBoxSize);
     _color0 = fetchRGBAParam(kParamColor0);
     _color1 = fetchRGBAParam(kParamColor1);
     _color2 = fetchRGBAParam(kParamColor2);
     _color3 = fetchRGBAParam(kParamColor3);
     _lineColor = fetchRGBAParam(kParamLineColor);
     _lineWidth = fetchDoubleParam(kParamLineWidth);
     _centerlineColor = fetchRGBAParam(kParamCenterLineColor);
     _centerlineWidth = fetchDoubleParam(kParamCenterLineWidth);
     assert(_size && _color0 && _color1 && _color2 && _color3 && _lineColor && _lineWidth && _centerlineColor && _centerlineWidth);
 }
Ejemplo n.º 6
0
ConvolutionPlugin::ConvolutionPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
{
	_paramSize = fetchInt2DParam( kParamSize );

	_paramCoef.resize( kParamSizeMax );
	for( unsigned int y = 0; y < kParamSizeMax; ++y )
	{
		_paramCoef[y].resize( kParamSizeMax );
		for( unsigned int x = 0; x < kParamSizeMax; ++x )
		{
			_paramCoef[y][x] = fetchDoubleParam( getCoefName( y, x ) );
		}
	}
}
Ejemplo n.º 7
0
ColorGradationPlugin::ColorGradationPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
{
	_paramIn              = fetchChoiceParam( kParamIn );
	_paramOut             = fetchChoiceParam( kParamOut );

	_paramInGamma         = fetchDoubleParam( kColorSpaceInGammaValue    );
	_paramOutGamma        = fetchDoubleParam( kColorSpaceOutGammaValue   );
	_paramInBlackPoint    = fetchDoubleParam( kColorSpaceInBlackPoint    );
	_paramOutBlackPoint   = fetchDoubleParam( kColorSpaceOutBlackPoint   );
	_paramInWhitePoint    = fetchDoubleParam( kColorSpaceInWhitePoint    );
	_paramOutWhitePoint   = fetchDoubleParam( kColorSpaceOutWhitePoint   );
	_paramInGammaSensito  = fetchDoubleParam( kColorSpaceInGammaSensito  );
	_paramOutGammaSensito = fetchDoubleParam( kColorSpaceOutGammaSensito );

	_paramProcessAlpha    = fetchBooleanParam( kParamProcessAlpha );
	updateParameters();
}
Ejemplo n.º 8
0
/*
 * fecth plugin IHM parameters with plugin parameters pointer
 */
HistogramPlugin::HistogramPlugin(OfxImageEffectHandle handle)
    : ImageEffectGilPlugin(handle)
{
    _paramGlobalDisplaySelection = fetchBooleanParam(kGlobalDisplay); // global display

    _paramOverlayRSelection = fetchBooleanParam(kBoolRed);   // R (is channel selected?)
    _paramMutliplierR = fetchDoubleParam(kMultiplierRed);    // R multiplier
    _paramOverlayGSelection = fetchBooleanParam(kBoolGreen); // G (is channel selected?)
    _paramMutliplierG = fetchDoubleParam(kMultiplierGreen);  // G multiplier

    _paramOverlayBSelection = fetchBooleanParam(kBoolBlue); // B (is channel selected?)
    _paramMutliplierB = fetchDoubleParam(kMultiplierBlue);  // B multiplier

    _paramOverlayHSelection = fetchBooleanParam(kBoolHue);        // H (is channel selected?)
    _paramMutliplierH = fetchDoubleParam(kMultiplierHue);         // H multiplier
    _paramOverlaySSelection = fetchBooleanParam(kBoolSaturation); // S (is channel selected?)
    _paramMutliplierS = fetchDoubleParam(kMultiplierSaturation);  // S multiplier

    _paramOverlayLSelection = fetchBooleanParam(kBoolLightness); // L (is channel selected?)
    _paramMutliplierL = fetchDoubleParam(kMultiplierLightness);  // L multiplier

    _paramDisplayTypeSelection =
        fetchChoiceParam(kHistoDisplayListParamLabel); // histogram display list (Histogram overlay group)

    _paramDisplaySelection = fetchBooleanParam(kBoolSelection); // display selection on source clip (Selection group)
    _paramSelectionMode = fetchChoiceParam(kSelectionModeListParamLabel); // selection mode (Selection group)

    _paramSelectionMultiplierSelection = fetchDoubleParam(kselectionMultiplier); // selection multiplier (Advanced group)
    _paramRefreshOverlaySelection = fetchPushButtonParam(kButtonRefreshOverlay); // refresh overlay (Advanced group)
    _paramNbStepSelection = fetchIntParam(knbStepRange);                         // nb step range (Advanced group)

    // Reset param booleans
    _isCleaned = false;
    _isNbStepChanged = false;
    _isHistogramRefresh = false;

    // Initialize scoped pointer
    _overlayDataCount = 0;

    /// @todo: HACK to display curves default position
    OFX::InstanceChangedArgs changed(this->timeLineGetTime());
    changedClip(changed, kOfxImageEffectSimpleSourceClipName);
}