Пример #1
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);
}
Пример #2
0
DiffPlugin::DiffPlugin( OfxImageEffectHandle handle )
	: OFX::ImageEffect( handle )
{
	_clipSrcA = fetchClip( kDiffSourceA );
	_clipSrcB = fetchClip( kDiffSourceB );
	_clipDst  = fetchClip( kOfxImageEffectOutputClipName );

	_measureFunction = fetchChoiceParam ( kMeasureFunction );
	_qualityMesure   = fetchRGBAParam( kOutputQualityMesure );
}
Пример #3
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

}
Пример #4
0
WriterPlugin::WriterPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
	, _oneRender( false )
	, _oneRenderAtTime( 0 )
{
	_clipSrc             = fetchClip( kOfxImageEffectSimpleSourceClipName );
	_clipDst             = fetchClip( kOfxImageEffectOutputClipName );
	_paramFilepath       = fetchStringParam( kParamWriterFilename );
	_paramRenderButton   = fetchPushButtonParam( kParamWriterRender );
	_paramRenderAlways   = fetchBooleanParam( kParamWriterRenderAlways );
	_paramBitDepth       = fetchChoiceParam( kParamWriterBitDepth );
	_paramForceNewRender = fetchIntParam( kParamWriterForceNewRender );
	_paramFlip           = fetchBooleanParam( kParamWriterFlip );
	_isSequence          = _filePattern.initFromDetection( _paramFilepath->getValue() );
}
Пример #5
0
ImageStatisticsPlugin::ImageStatisticsPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
{
	_clipMask = fetchClip( kClipMask );

	_paramRestrictToRegion = fetchBooleanParam( kParamRestrictToRegion );

	_paramCoordinateSystem = fetchChoiceParam( kParamCoordinateSystem );
	_paramRectCenter       = fetchDouble2DParam( kParamRectCenter );
	_paramRectSize         = fetchDouble2DParam( kParamRectSize );
	_paramChooseOutput     = fetchChoiceParam( kParamChooseOutput );

	_paramOutputNbPixels = fetchIntParam( kParamOutputNbPixels );
	
	_paramOutputAverage       = fetchRGBAParam( kParamOutputAverage );
	_paramOutputVariance      = fetchRGBAParam( kParamOutputVariance );
	_paramOutputChannelMin    = fetchRGBAParam( kParamOutputChannelMin );
	_paramOutputChannelMax    = fetchRGBAParam( kParamOutputChannelMax );
	_paramOutputLuminosityMin = fetchRGBAParam( kParamOutputLuminosityMin );
	_paramOutputLuminosityMax = fetchRGBAParam( kParamOutputLuminosityMax );
	_paramOutputKurtosis      = fetchRGBAParam( kParamOutputKurtosis );
	_paramOutputSkewness      = fetchRGBAParam( kParamOutputSkewness );

	_paramOutputAverageHSL       = fetchDouble3DParam( kParamOutputAverageHSL );
	_paramOutputVarianceHSL      = fetchDouble3DParam( kParamOutputVarianceHSL );
	_paramOutputChannelMinHSL    = fetchDouble3DParam( kParamOutputChannelMinHSL );
	_paramOutputChannelMaxHSL    = fetchDouble3DParam( kParamOutputChannelMaxHSL );
	_paramOutputLuminosityMinHSL = fetchDouble3DParam( kParamOutputLuminosityMinHSL );
	_paramOutputLuminosityMaxHSL = fetchDouble3DParam( kParamOutputLuminosityMaxHSL );
	_paramOutputKurtosisHSL      = fetchDouble3DParam( kParamOutputKurtosisHSL );
	_paramOutputSkewnessHSL      = fetchDouble3DParam( kParamOutputSkewnessHSL );
	
	OFX::InstanceChangedArgs args( this->timeLineGetTime() );
	changedParam( args, kParamRestrictToRegion );
}
Пример #6
0
ReaderPlugin::ReaderPlugin( OfxImageEffectHandle handle )
	: OFX::ImageEffect( handle )
{
	_clipDst           = fetchClip( kOfxImageEffectOutputClipName );
	_paramFilepath     = fetchStringParam( kParamReaderFilename );
	_isSequence        = _filePattern.initFromDetection( _paramFilepath->getValue() );
	_paramExplicitConv = fetchChoiceParam( kParamReaderExplicitConversion );
	_paramFlip         = fetchBooleanParam( kParamReaderFlip );
}
Пример #7
0
CImgOperatorPluginHelperBase::CImgOperatorPluginHelperBase(OfxImageEffectHandle handle,
                                                           const char* srcAClipName, //!< should be either kOfxImageEffectSimpleSourceClipName or "A" if you want this to be the default output when plugin is disabled
                                                           const char* srcBClipName,
                                                           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,
                                                           bool defaultProcessAlphaOnRGBA)
: CImgFilterPluginHelperBase(handle, supportsComponentRemapping, supportsTiles, supportsMultiResolution, supportsRenderScale, defaultUnpremult, defaultProcessAlphaOnRGBA, false)
, _srcAClip(0)
, _srcBClip(0)
, _srcAClipName(srcAClipName)
, _srcBClipName(srcBClipName)
{
    _srcAClip = fetchClip(_srcAClipName);
    assert(_srcAClip && (_srcAClip->getPixelComponents() == OFX::ePixelComponentRGB || _srcAClip->getPixelComponents() == OFX::ePixelComponentRGBA));
    _srcBClip = fetchClip(_srcBClipName);
    assert(_srcBClip && (_srcBClip->getPixelComponents() == OFX::ePixelComponentRGB || _srcBClip->getPixelComponents() == OFX::ePixelComponentRGBA));
}
Пример #8
0
ReaderPlugin::ReaderPlugin(OfxImageEffectHandle handle)
    : OFX::ImageEffect(handle)
    , _isSequence(false)
    , _filePattern()
{
    _clipDst = fetchClip(kOfxImageEffectOutputClipName);
    _paramFilepath = fetchStringParam(kTuttlePluginFilename);
    _isSequence = sequenceParser::browseSequence(_filePattern, _paramFilepath->getValue());
    _paramBitDepth = fetchChoiceParam(kTuttlePluginBitDepth);
    _paramChannel = fetchChoiceParam(kTuttlePluginChannel);
}
Пример #9
0
WriterPlugin::WriterPlugin( OfxImageEffectHandle handle )
	: ImageEffectGilPlugin( handle )
	, _oneRender( false )
	, _oneRenderAtTime( 0 )
	, _isSequence( false )
	, _filePattern()
{
	_clipSrc = fetchClip( kOfxImageEffectSimpleSourceClipName );
	_clipDst = fetchClip( kOfxImageEffectOutputClipName );
	_paramFilepath = fetchStringParam( kTuttlePluginFilename );
	_paramRenderButton = fetchPushButtonParam( kParamWriterRender );
	_paramRenderAlways = fetchBooleanParam( kParamWriterRenderAlways );
	_paramCopyToOutput = fetchBooleanParam( kParamWriterCopyToOutput );
	_paramBitDepth = fetchChoiceParam( kTuttlePluginBitDepth );
	_paramPremult = fetchBooleanParam( kParamPremultiplied );
	_paramExistingFile = fetchChoiceParam( kParamWriterExistingFile );
	_paramForceNewRender = fetchIntParam( kParamWriterForceNewRender );

	// update params
	changedParam( OFX::InstanceChangedArgs(), kTuttlePluginFilename );
}