TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/attribute/ParamRGB.cpp
Go to the documentation of this file.
00001 #include "ParamRGB.hpp"
00002 
00003 #include <tuttle/host/INode.hpp>
00004 
00005 namespace tuttle {
00006 namespace host {
00007 namespace attribute {
00008 
00009 ParamRGB::ParamRGB( INode&                           effect,
00010                     const std::string&                         name,
00011                     const ofx::attribute::OfxhParamDescriptor& descriptor )
00012         : Param( effect )
00013         , ParamDoubleMultiDim<3>( descriptor, name, effect.getParamSet() )
00014 {
00015         _controls.replace<0>( new ParamDouble( effect, name + ".r", descriptor, 0 ) );
00016         _controls.replace<1>( new ParamDouble( effect, name + ".g", descriptor, 1 ) );
00017         _controls.replace<2>( new ParamDouble( effect, name + ".b", descriptor, 2 ) );
00018 }
00019 
00020 OfxRGBColourD ParamRGB::getDefault() const
00021 {
00022         OfxRGBColourD rgb;
00023 
00024         rgb.r = _controls.at<0>().getDefault();
00025         rgb.g = _controls.at<1>().getDefault();
00026         rgb.b = _controls.at<2>().getDefault();
00027         return rgb;
00028 }
00029 
00030 void ParamRGB::getValue( double& r, double& g, double& b ) const OFX_EXCEPTION_SPEC
00031 {
00032         _controls.at<0>().getValue( r );
00033         _controls.at<1>().getValue( g );
00034         _controls.at<2>().getValue( b );
00035 }
00036 
00037 void ParamRGB::getValueAtTime( const OfxTime time, double& r, double& g, double& b ) const OFX_EXCEPTION_SPEC
00038 {
00039         _controls.at<0>().getValueAtTime( time, r );
00040         _controls.at<1>().getValueAtTime( time, g );
00041         _controls.at<2>().getValueAtTime( time, b );
00042 }
00043 
00044 void ParamRGB::setValue( const double& r, const double& g, const double& b, const ofx::attribute::EChange change ) OFX_EXCEPTION_SPEC
00045 {
00046         _controls.at<0>().setValue( r, change );
00047         _controls.at<1>().setValue( g, change );
00048         _controls.at<2>().setValue( b, change );
00049         this->paramChanged( change );
00050 }
00051 
00052 void ParamRGB::setValueAtTime( const OfxTime time, const double& r, const double& g, const double& b, const ofx::attribute::EChange change ) OFX_EXCEPTION_SPEC
00053 {
00054         _controls.at<0>().setValueAtTime( time, r, change );
00055         _controls.at<1>().setValueAtTime( time, g, change );
00056         _controls.at<2>().setValueAtTime( time, b, change );
00057         this->paramChanged( change );
00058 }
00059 
00060 }
00061 }
00062 }
00063