TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/plugin/context/SamplerPlugin.cpp
Go to the documentation of this file.
00001 #include "SamplerPlugin.hpp"
00002 #include <terry/sampler/sampler.hpp>
00003 
00004 namespace tuttle {
00005 namespace plugin {
00006 
00007 SamplerPlugin::SamplerPlugin( OfxImageEffectHandle handle )
00008         : ImageEffectGilPlugin( handle )
00009 {
00010         _paramFilter          = fetchChoiceParam   ( kParamFilter );
00011         _paramB               = fetchDoubleParam   ( kParamFilterB );
00012         _paramC               = fetchDoubleParam   ( kParamFilterC );
00013         _paramFilterSize      = fetchIntParam      ( kParamFilterSize );
00014         _paramFilterSigma     = fetchDoubleParam   ( kParamFilterSigma );
00015         _paramFilterSharpen   = fetchDoubleParam   ( kParamFilterSharpen );
00016         _paramOutOfImage      = fetchChoiceParam   ( kParamFilterOutOfImage );
00017 }
00018 
00019 SamplerPlugin::~SamplerPlugin()
00020 {}
00021 
00022 void SamplerPlugin::changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName )
00023 {
00024         if( paramName == kParamFilter )
00025         {
00026                 if( _paramFilter->getValue() == terry::sampler::eParamFilterBC )
00027                 {
00028                         _paramB->setIsSecretAndDisabled( false );
00029                         _paramC->setIsSecretAndDisabled( false );
00030                 }
00031                 else
00032                 {
00033                         _paramB->setIsSecretAndDisabled( true );
00034                         _paramC->setIsSecretAndDisabled( true );
00035                 }
00036                 if( ( _paramFilter->getValue() == terry::sampler::eParamFilterLanczos ) || ( _paramFilter->getValue() == terry::sampler::eParamFilterGaussian ) )
00037                 {
00038                         _paramFilterSize->setIsSecretAndDisabled( false );
00039                 }
00040                 else
00041                 {
00042                         _paramFilterSize->setIsSecretAndDisabled( true );
00043                 }
00044                 if( _paramFilter->getValue() == terry::sampler::eParamFilterLanczos )
00045                 {
00046                         _paramFilterSharpen->setIsSecretAndDisabled( false );
00047                 }
00048                 else
00049                 {
00050                         _paramFilterSharpen->setIsSecretAndDisabled( true );
00051                 }
00052                 if( _paramFilter->getValue() == terry::sampler::eParamFilterGaussian )
00053                 {
00054                         _paramFilterSigma->setIsSecretAndDisabled( false );
00055                 }
00056                 else
00057                 {
00058                         _paramFilterSigma->setIsSecretAndDisabled( true );
00059                 }
00060         }
00061 }
00062 
00063 void SamplerPlugin::fillProcessParams( SamplerProcessParams& samplerprocessParam ) const
00064 {
00065         samplerprocessParam._filter            = (terry::sampler::EParamFilter)           _paramFilter     -> getValue();
00066         samplerprocessParam._filterSize        = (double) _paramFilterSize    -> getValue();
00067         samplerprocessParam._filterSigma       = (double) _paramFilterSigma   -> getValue();
00068         samplerprocessParam._filterSharpen     = (double) _paramFilterSharpen -> getValue();
00069         samplerprocessParam._paramB            = (double) _paramB             -> getValue();
00070         samplerprocessParam._paramC            = (double) _paramC             -> getValue();
00071         samplerprocessParam._outOfImageProcess = (terry::sampler::EParamFilterOutOfImage) _paramOutOfImage  -> getValue();
00072 }
00073 
00074 }
00075 }