The Rotate Flip filter allows image data to be flipped and rotated in steps of 90 degrees.
The Rotate Flip filter is loaded by an application using the following code:
// Load the Rotate Flip filter from the stdfilters.ftf module. #ifdef _DEBUG smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", // Filter name. "stdfiltersd.ftf" ); // Module file. #else smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", // Filter name. "stdfilters.ftf" ); // Module file. #endif
The part of the image that is copied to the destination frame is determined by four filter parameters:
The rotation angle and flipping modes can be specified in the filter's property dialog:
If the parameters should be set by an application, the following source code can be used:
long lAngle = 0; long lNewAngle = 0; bool bFlipVertical = false; bool bFlipHorizontal = false; //Retrieve the current parameter settings. pFilter->getParameter( "Rotation Angle", lAngle ); pFilter->getParameter( "Flip V", bFlipVertical ); pFilter->getParameter( "Flip H", bFlipHorizontal ); //Change the parameters. lNewAngle = 90; // Only the values 0, 90, 180 270 are allowed. // If the rotation value is 90 or 270, then the resulting video format // is changed. Thus, the new value can only be set while the live video is // stopped. Otherwise, an error is returned by setParameter(). if( abs(lAngle - lNewAngle) == 90 || abs(lAngle - lNewAngle ) == 270 ) { if( m_Grabber.isLive() == false ) { pFilter->setParameter( "Rotation Angle", lAngle ); } } else { pFilter->setParameter( "Rotation Angle", lAngle ); } // The flip parameters do not cause a video format change, so they can be // set regardless of whether the live video is running. bFlipVertical = true; bFlipHorizontal = true; pFilter->setParameter( "Flip V", bFlipVertical ); pFilter->setParameter( "Flip H", bFlipHorizontal );