本文整理汇总了C++中MyWindow::redraw方法的典型用法代码示例。如果您正苦于以下问题:C++ MyWindow::redraw方法的具体用法?C++ MyWindow::redraw怎么用?C++ MyWindow::redraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyWindow
的用法示例。
在下文中一共展示了MyWindow::redraw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: liveLoop
//.........这里部分代码省略.........
int requestNr = -1;
bool boLoopRunning = true;
unsigned int cnt = 0;
while( boLoopRunning )
{
// wait for results from the default capture queue
requestNr = fi.imageRequestWaitFor( timeout_ms );
if( fi.isRequestNrValid( requestNr ) )
{
pRequest = fi.getRequest( requestNr );
if( pRequest->isOK() )
{
++cnt;
// here we can display some statistical information every 20th image
if( cnt % 20 == 0 )
{
ostringstream out;
out << pDev->serial.read() << ": " << statistics.framesPerSecond.name() << ": " << statistics.framesPerSecond.readS();
pWindow->setOverlayString( out.str() );
cout << cnt << ": Info from " << pDev->serial.read()
<< ": " << statistics.framesPerSecond.name() << ": " << statistics.framesPerSecond.readS()
<< ", " << statistics.errorCount.name() << ": " << statistics.errorCount.readS()
<< ", " << statistics.captureTime_s.name() << ": " << statistics.captureTime_s.readS()
<< " Image count: " << cnt
<< " (dimensions: " << pRequest->imageWidth.read() << "x" << pRequest->imageHeight.read() << ", format: " << pRequest->imagePixelFormat.readS();
if( pRequest->imageBayerMosaicParity.read() != bmpUndefined )
{
cout << ", " << pRequest->imageBayerMosaicParity.name() << ": " << pRequest->imageBayerMosaicParity.readS();
}
cout << ")" << endl;
}
// here we can store an image every 100th frame
if( boStoreFrames && ( cnt % 100 == 0 ) )
{
ostringstream oss;
oss << "Image" << cnt << "." << pRequest->imageWidth.read() << "x" << pRequest->imageHeight.read() << "." << pRequest->imagePixelFormat.readS();
if( pRequest->imageBayerMosaicParity.read() != bmpUndefined )
{
oss << "(BayerPattern=" << pRequest->imageBayerMosaicParity.readS() << ")";
}
oss << ".raw";
FILE* fp = fopen( oss.str().c_str(), "wb" );
if( fp )
{
unsigned char* pImageData = ( unsigned char* ) pRequest->imageData.read();
for( int h = 0; h < pRequest->imageHeight.read(); h++ )
{
// write one line
fwrite( pImageData, pRequest->imageWidth.read(), pRequest->imageBytesPerPixel.read(), fp );
// respect image line pitch
pImageData += pRequest->imageLinePitch.read();
}
fclose( fp );
}
}
// everything went well. Display the result
pWindow->NewRequest( pRequest );
pWindow->redraw();
Fl::check();
}
else
{
cout << "*** Error: A request has been returned with the following result: " << pRequest->requestResult << endl;
}
// this image has been displayed thus the buffer is no longer needed...
fi.imageRequestUnlock( requestNr );
// send a new image request into the capture queue
fi.imageRequestSingle();
if( boSingleShotMode )
{
manuallyStartAcquisitionIfNeeded( pDev, fi );
}
}
else
{
cout << "*** Error: Result of waiting for a finished request: " << requestNr << "("
<< ImpactAcquireException::getErrorCodeAsString( requestNr ) << "). Timeout value too small?" << endl;
}
boLoopRunning = waitForInput( 0, STDOUT_FILENO ) == 0 ? true : false; // break by STDIN
// Exit when window was cloesd
if( s_boTerminated )
{
break;
}
}
if( !boSingleShotMode )
{
manuallyStopAcquisitionIfNeeded( pDev, fi );
}
cout << " == " << __FUNCTION__ << " - free resources...." << endl;
// free resources
fi.imageRequestReset( 0, 0 );
return 0;
}