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