MCPcopy Create free account
hub / github.com/LUX-Core/lux / saveRastered

Method saveRastered

src/qt/qcustomplot.cpp:15608–15625  ·  view source on GitHub ↗

! Saves the plot to a rastered image file \a fileName in the image format \a format. The plot is sized to \a width and \a height in pixels and scaled with \a scale. (width 100 and scale 2.0 lead to a full resolution file with width 200.) If the \a format supports compression, \a quality may be between 0 and 100 to control it. Returns true on success. If this function fails, most likely

Source from the content-addressed store, hash-verified

15606 \see saveBmp, saveJpg, savePng, savePdf
15607*/
15608bool QCustomPlot::saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality, int resolution, QCP::ResolutionUnit resolutionUnit)
15609{
15610 QImage buffer = toPixmap(width, height, scale).toImage();
15611
15612 int dotsPerMeter = 0;
15613 switch (resolutionUnit)
15614 {
15615 case QCP::ruDotsPerMeter: dotsPerMeter = resolution; break;
15616 case QCP::ruDotsPerCentimeter: dotsPerMeter = resolution*100; break;
15617 case QCP::ruDotsPerInch: dotsPerMeter = resolution/0.0254; break;
15618 }
15619 buffer.setDotsPerMeterX(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools
15620 buffer.setDotsPerMeterY(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools
15621 if (!buffer.isNull())
15622 return buffer.save(fileName, format, quality);
15623 else
15624 return false;
15625}
15626
15627/*!
15628 Renders the plot to a pixmap and returns it.

Callers

nothing calls this directly

Calls 2

isNullMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected