MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / captureUIScreenShot

Method captureUIScreenShot

source/MRViewer/MRViewer.cpp:2613–2640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2611}
2612
2613void Viewer::captureUIScreenShot( std::function<void( const Image& )> callback,
2614 const Vector2i& pos /*= Vector2i()*/, const Vector2i& sizeP /*= Vector2i() */ )
2615{
2616 CommandLoop::appendCommand( [callback, pos, sizeP, this] ()
2617 {
2618 Vector2i size = sizeP;
2619 if ( !size.x )
2620 size.x = framebufferSize.x - pos.x;
2621 else
2622 size.x = std::min( framebufferSize.x - pos.x, size.x );
2623
2624 if ( !size.y )
2625 size.y = framebufferSize.y - pos.y;
2626 else
2627 size.y = std::min( framebufferSize.y - pos.y, size.y );
2628
2629 Image image;
2630 image.resolution = size;
2631 image.pixels.resize( size.x * size.x );
2632
2633 if ( glInitialized_ )
2634 {
2635 GL_EXEC( glReadPixels( pos.x, pos.y, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, ( void* ) ( image.pixels.data() ) ) );
2636
2637 callback( image );
2638 }
2639 } );
2640}
2641
2642bool Viewer::isAlphaSortAvailable() const
2643{

Callers 3

actionMethod · 0.80

Calls 3

minFunction · 0.85
resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected