MCPcopy Create free account
hub / github.com/KLayout/klayout / save_screenshot

Method save_screenshot

src/laybasic/laybasic/layLayoutViewBase.cc:3009–3028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3007
3008#if defined(HAVE_QT) && !defined(PREFER_LIBPNG_FOR_SAVE)
3009void
3010LayoutViewBase::save_screenshot (const std::string &fn)
3011{
3012 tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Save screenshot")));
3013
3014 QImageWriter writer (tl::to_qstring (fn), QByteArray ("PNG"));
3015
3016 std::vector<std::pair<std::string, std::string> > texts = png_texts (this, box ());
3017 for (auto i = texts.begin (); i != texts.end (); ++i) {
3018 writer.setText (tl::to_qstring (i->first), tl::to_qstring (i->second));
3019 }
3020
3021 refresh ();
3022
3023 if (! writer.write (mp_canvas->screenshot ().to_image ())) {
3024 throw tl::Exception (tl::to_string (tr ("Unable to write screenshot to file: %s (%s)")), fn, tl::to_string (writer.errorString ()));
3025 }
3026
3027 tl::log << "Saved screen shot to " << fn;
3028}
3029#elif defined(HAVE_PNG)
3030void
3031LayoutViewBase::save_screenshot (const std::string &fn)

Callers 2

test10.rbFile · 0.80
cm_screenshotMethod · 0.80

Calls 15

verbosityFunction · 0.85
to_qstringFunction · 0.85
png_textsFunction · 0.85
screenshotMethod · 0.80
write_pngMethod · 0.80
boxFunction · 0.70
refreshFunction · 0.70
to_stringFunction · 0.50
trFunction · 0.50
QByteArrayClass · 0.50
ExceptionClass · 0.50
beginMethod · 0.45

Tested by

no test coverage detected