MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / renderToFile

Method renderToFile

libs/qCC_glWindow/src/ccGLWindowInterface.cpp:3344–3379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3342}
3343
3344bool ccGLWindowInterface::renderToFile( QString filename,
3345 float zoomFactor/*=1.0*/,
3346 bool dontScaleFeatures/*=false*/,
3347 bool renderOverlayItems/*=false*/)
3348{
3349 if (filename.isEmpty() || zoomFactor < 1.0e-2f)
3350 {
3351 return false;
3352 }
3353
3354 QImage outputImage = renderToImage(zoomFactor, dontScaleFeatures, renderOverlayItems);
3355
3356 if (outputImage.isNull())
3357 {
3358 //an error occurred (message should have already been issued!)
3359 return false;
3360 }
3361
3362 if (getDisplayParameters().drawRoundedPoints)
3363 {
3364 //convert the image to plain RGB to avoid issues with points transparency when saving to PNG
3365 outputImage = outputImage.convertToFormat(QImage::Format_RGB32);
3366 }
3367
3368 bool success = outputImage.convertToFormat(QImage::Format_RGB32).save(filename);
3369 if (success)
3370 {
3371 ccLog::Print(QString("[Snapshot] File '%1' saved! (%2 x %3 pixels)").arg(filename).arg(outputImage.width()).arg(outputImage.height()));
3372 }
3373 else
3374 {
3375 ccLog::Warning(QString("[Snapshot] Failed to save file '%1'!").arg(filename));
3376 }
3377
3378 return success;
3379}
3380
3381void ccGLWindowInterface::SetShaderPath(const QString& path)
3382{

Callers 2

doActionRenderToFileMethod · 0.80
exportMapAsImageMethod · 0.80

Calls 6

isNullMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
QStringClass · 0.50
isEmptyMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected