TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/plugin/param/gilColor.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_PARAM_GILCOLOR_HPP_
00002 #define _TUTTLE_PLUGIN_PARAM_GILCOLOR_HPP_
00003 
00004 #include <ofxsParam.h>
00005 #include <boost/gil/color_base_algorithm.hpp>
00006 #include <boost/gil/rgba.hpp>
00007 #include <boost/gil/channel.hpp>
00008 
00009 namespace tuttle {
00010 namespace plugin {
00011 
00012 template <typename Pixel>
00013 void setRGBAParamValuesAtTime( OFX::RGBAParam& param, const OfxTime time, const Pixel& pixel  )
00014 {
00015         using namespace boost::gil;
00016         param.setValueAtTime(
00017                 time,
00018                 get_color( pixel, red_t() ),
00019                 get_color( pixel, green_t() ),
00020                 get_color( pixel, blue_t() ),
00021                 get_color( pixel, alpha_t() )
00022                 );
00023 }
00024 template <typename Pixel>
00025 void setRGBAParamValuesAtTime( OFX::RGBAParam* param, const OfxTime time, const Pixel& pixel  )
00026 {
00027         setRGBAParamValuesAtTime<Pixel>( *param, time, pixel  );
00028 }
00029 template <typename Pixel>
00030 void setRGBParamValuesAtTime( OFX::RGBAParam& param, const OfxTime time, const Pixel& pixel  )
00031 {
00032         using namespace boost::gil;
00033         typedef typename boost::gil::channel_type<Pixel>::type Channel;
00034         param.setValueAtTime(
00035                 time,
00036                 get_color( pixel, red_t() ),
00037                 get_color( pixel, green_t() ),
00038                 get_color( pixel, blue_t() ),
00039                 channel_traits<Channel>::max_value()
00040                 );
00041 }
00042 template <typename Pixel>
00043 void setRGBParamValuesAtTime( OFX::RGBAParam* param, const OfxTime time, const Pixel& pixel  )
00044 {
00045         setRGBParamValuesAtTime<Pixel>( *param, time, pixel  );
00046 }
00047 
00048 template <typename Pixel>
00049 void setRGBAParamValues( OFX::RGBAParam& param, const Pixel& pixel  )
00050 {
00051         using namespace boost::gil;
00052         param.setValue(
00053                 get_color( pixel, red_t() ),
00054                 get_color( pixel, green_t() ),
00055                 get_color( pixel, blue_t() ),
00056                 get_color( pixel, alpha_t() )
00057                 );
00058 }
00059 template <typename Pixel>
00060 void setRGBAParamValues( OFX::RGBAParam* param, const Pixel& pixel  )
00061 {
00062         setRGBAParamValues( *param, pixel  );
00063 }
00064 
00065 template <typename Pixel>
00066 void setRGBParamValues( OFX::RGBAParam& param, const Pixel& pixel  )
00067 {
00068         using namespace boost::gil;
00069         typedef typename boost::gil::channel_type<Pixel>::type Channel;
00070         param.setValue(
00071                 get_color( pixel, red_t() ),
00072                 get_color( pixel, green_t() ),
00073                 get_color( pixel, blue_t() ),
00074                 channel_traits<Channel>::max_value()
00075                 );
00076 }
00077 template <typename Pixel>
00078 void setRGBParamValues( OFX::RGBAParam* param, const Pixel& pixel  )
00079 {
00080         setRGBParamValues<Pixel>( *param, pixel  );
00081 }
00082 
00083 template <typename Pixel>
00084 void setRGBParamValuesAtTime( OFX::RGBParam& param, const OfxTime time, const Pixel& pixel  )
00085 {
00086         using namespace boost::gil;
00087         param.setValueAtTime(
00088                 time,
00089                 get_color( pixel, red_t() ),
00090                 get_color( pixel, green_t() ),
00091                 get_color( pixel, blue_t() )
00092                 );
00093 }
00094 template <typename Pixel>
00095 void setRGBParamValuesAtTime( OFX::RGBParam* param, const OfxTime time, const Pixel& pixel  )
00096 {
00097         setRGBParamValuesAtTime<Pixel>( *param, time, pixel  );
00098 }
00099 
00100 template <typename Pixel>
00101 void setRGBParamValues( OFX::RGBParam& param, const Pixel& pixel  )
00102 {
00103         using namespace boost::gil;
00104         param.setValue(
00105                 get_color( pixel, red_t() ),
00106                 get_color( pixel, green_t() ),
00107                 get_color( pixel, blue_t() )
00108                 );
00109 }
00110 template <typename Pixel>
00111 void setRGBParamValues( OFX::RGBParam* param, const Pixel& pixel  )
00112 {
00113         setRGBParamValues<Pixel>( *param, pixel  );
00114 }
00115 
00116 template <typename Pixel>
00117 void setRGBParamValuesAtTime( OFX::Double3DParam& param, const OfxTime time, const Pixel& pixel  )
00118 {
00119         using namespace boost::gil;
00120         param.setValueAtTime(
00121                 time,
00122                 get_color( pixel, red_t() ),
00123                 get_color( pixel, green_t() ),
00124                 get_color( pixel, blue_t() )
00125                 );
00126 }
00127 
00128 template <typename Pixel>
00129 void setRGBParamValuesAtTime( OFX::Double3DParam* param, const OfxTime time, const Pixel& pixel  )
00130 {
00131         setRGBParamValuesAtTime<Pixel>( *param, time, pixel  );
00132 }
00133 
00134 template <typename Pixel>
00135 void setRGBParamValues( OFX::Double3DParam& param, const Pixel& pixel  )
00136 {
00137         using namespace boost::gil;
00138         param.setValue(
00139                 get_color( pixel, red_t() ),
00140                 get_color( pixel, green_t() ),
00141                 get_color( pixel, blue_t() )
00142                 );
00143 }
00144 
00145 template <typename Pixel>
00146 void setRGBParamValues( OFX::Double3DParam* param, const Pixel& pixel  )
00147 {
00148         setRGBParamValues<Pixel>( *param, pixel );
00149 }
00150 
00151 
00152 template <typename Pixel>
00153 void set0123ParamValuesAtTime( OFX::RGBAParam& param, const OfxTime time, const Pixel& pixel  )
00154 {
00155         using namespace boost::gil;
00156         param.setValueAtTime(
00157                 time,
00158                 pixel[0],
00159                 pixel[1],
00160                 pixel[2],
00161                 pixel[3]
00162                 );
00163 }
00164 template <typename Pixel>
00165 void set0123ParamValuesAtTime( OFX::RGBAParam* param, const OfxTime time, const Pixel& pixel  )
00166 {
00167         set0123ParamValuesAtTime<Pixel>( *param, time, pixel  );
00168 }
00169 template <typename Pixel>
00170 void set012ParamValuesAtTime( OFX::RGBAParam& param, const OfxTime time, const Pixel& pixel  )
00171 {
00172         using namespace boost::gil;
00173         typedef typename boost::gil::channel_type<Pixel>::type Channel;
00174         param.setValueAtTime(
00175                 time,
00176                 pixel[0],
00177                 pixel[1],
00178                 pixel[2],
00179                 channel_traits<Channel>::max_value()
00180                 );
00181 }
00182 template <typename Pixel>
00183 void set012ParamValuesAtTime( OFX::RGBAParam* param, const OfxTime time, const Pixel& pixel  )
00184 {
00185         set012ParamValuesAtTime<Pixel>( *param, time, pixel  );
00186 }
00187 
00188 template <typename Pixel>
00189 void set0123ParamValues( OFX::RGBAParam& param, const Pixel& pixel  )
00190 {
00191         using namespace boost::gil;
00192         param.setValue(
00193                 pixel[0],
00194                 pixel[1],
00195                 pixel[2],
00196                 pixel[3]
00197                 );
00198 }
00199 template <typename Pixel>
00200 void set0123ParamValues( OFX::RGBAParam* param, const Pixel& pixel  )
00201 {
00202         set0123ParamValues( *param, pixel  );
00203 }
00204 
00205 template <typename Pixel>
00206 void set012ParamValues( OFX::RGBAParam& param, const Pixel& pixel  )
00207 {
00208         using namespace boost::gil;
00209         typedef typename boost::gil::channel_type<Pixel>::type Channel;
00210         param.setValue(
00211                 pixel[0],
00212                 pixel[1],
00213                 pixel[2],
00214                 channel_traits<Channel>::max_value()
00215                 );
00216 }
00217 template <typename Pixel>
00218 void set012ParamValues( OFX::RGBAParam* param, const Pixel& pixel  )
00219 {
00220         set012ParamValues<Pixel>( *param, pixel  );
00221 }
00222 
00223 template <typename Pixel>
00224 void set012ParamValuesAtTime( OFX::RGBParam& param, const OfxTime time, const Pixel& pixel  )
00225 {
00226         using namespace boost::gil;
00227         param.setValueAtTime(
00228                 time,
00229                 pixel[0],
00230                 pixel[1],
00231                 pixel[2]
00232                 );
00233 }
00234 template <typename Pixel>
00235 void set012ParamValuesAtTime( OFX::RGBParam* param, const OfxTime time, const Pixel& pixel  )
00236 {
00237         set012ParamValuesAtTime<Pixel>( *param, time, pixel  );
00238 }
00239 
00240 template <typename Pixel>
00241 void set012ParamValues( OFX::RGBParam& param, const Pixel& pixel  )
00242 {
00243         using namespace boost::gil;
00244         param.setValue(
00245                 pixel[0],
00246                 pixel[1],
00247                 pixel[2]
00248                 );
00249 }
00250 template <typename Pixel>
00251 void set012ParamValues( OFX::RGBParam* param, const Pixel& pixel  )
00252 {
00253         set012ParamValues<Pixel>( *param, pixel  );
00254 }
00255 
00256 template <typename Pixel>
00257 void set012ParamValuesAtTime( OFX::Double3DParam& param, const OfxTime time, const Pixel& pixel  )
00258 {
00259         using namespace boost::gil;
00260         param.setValueAtTime(
00261                 time,
00262                 pixel[0],
00263                 pixel[1],
00264                 pixel[2]
00265                 );
00266 }
00267 
00268 template <typename Pixel>
00269 void set012ParamValuesAtTime( OFX::Double3DParam* param, const OfxTime time, const Pixel& pixel  )
00270 {
00271         set012ParamValuesAtTime<Pixel>( *param, time, pixel  );
00272 }
00273 
00274 template <typename Pixel>
00275 void set012ParamValues( OFX::Double3DParam& param, const Pixel& pixel  )
00276 {
00277         using namespace boost::gil;
00278         param.setValue(
00279                 pixel[0],
00280                 pixel[1],
00281                 pixel[2]
00282                 );
00283 }
00284 
00285 template <typename Pixel>
00286 void set012ParamValues( OFX::Double3DParam* param, const Pixel& pixel  )
00287 {
00288         set012ParamValues<Pixel>( *param, pixel );
00289 }
00290 
00291 
00292 
00293 
00294 }
00295 }
00296 
00297 #endif