TuttleOFX  1
AnisotropicTensorsMargin.cpp
Go to the documentation of this file.
00001 #include "AnisotropicTensorsMargin.hpp"
00002 #include "AnisotropicTensorsPlugin.hpp"
00003 
00004 #include <tuttle/plugin/opengl/gl.h>
00005 
00006 #include <ofxsImageEffect.h>
00007 #include <ofxsInteract.h>
00008 #include <boost/gil/gil_all.hpp>
00009 
00010 namespace tuttle {
00011 namespace plugin {
00012 namespace anisotropicFilter {
00013 namespace tensors {
00014 
00015 bool TensorsMargin::draw( const OFX::DrawArgs &args )
00016 {
00017     TensorsPlugin *plugin = dynamic_cast<TensorsPlugin*>(_effect);
00018     if( plugin && plugin->_paramDisplayMargin->getValue() )
00019     {
00020         OfxRectD rect[2];
00021         rect[0] = plugin->_renderRect;
00022         rect[1] = plugin->_overSizedRect;
00023         // get the project size
00024         OfxPointD projSize, projOffset;
00025         projOffset = _effect->getProjectOffset( );
00026         projSize = _effect->getProjectSize( );
00027 
00028         glColor3f( 1.0f, 1.0f, 1.0f );
00029         glPushMatrix( );
00030         for( int i = 0; i < 2; i++ )
00031         {
00032             double x1 = projOffset.x + rect[i].x1;
00033             double y1 = projOffset.y + rect[i].y1;
00034             double x2 = projOffset.x + rect[i].x2;
00035             double y2 = projOffset.y + rect[i].y2;
00036             if( i >= 1 )
00037                 glColor3f( 1.0f, 1.00f, 0.0f );
00038 
00039             glBegin( GL_LINES );
00040 
00041             glVertex2f( x1, y1 );
00042             glVertex2f( x2, y1 );
00043 
00044             glVertex2f( x1, y2 );
00045             glVertex2f( x2, y2 );
00046 
00047             glVertex2f( x1, y1 );
00048             glVertex2f( x1, y2 );
00049 
00050             glVertex2f( x2, y1 );
00051             glVertex2f( x2, y2 );
00052 
00053             glEnd( );
00054         }
00055         glPopMatrix( );
00056                 return true; ///! @todo: true or false cf. doc openfx
00057     }
00058         return false;
00059 }
00060 
00061 
00062 }
00063 }
00064 }
00065 }