MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / saveRastered

Method saveRastered

3rdparty/qcustomplot/qcustomplot.cpp:16389–16406  ·  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

16387 \see saveBmp, saveJpg, savePng, savePdf
16388*/
16389bool QCustomPlot::saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality, int resolution, QCP::ResolutionUnit resolutionUnit)
16390{
16391 QImage buffer = toPixmap(width, height, scale).toImage();
16392
16393 int dotsPerMeter = 0;
16394 switch (resolutionUnit)
16395 {
16396 case QCP::ruDotsPerMeter: dotsPerMeter = resolution; break;
16397 case QCP::ruDotsPerCentimeter: dotsPerMeter = resolution*100; break;
16398 case QCP::ruDotsPerInch: dotsPerMeter = int(resolution/0.0254); break;
16399 }
16400 buffer.setDotsPerMeterX(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools
16401 buffer.setDotsPerMeterY(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools
16402 if (!buffer.isNull())
16403 return buffer.save(fileName, format, quality);
16404 else
16405 return false;
16406}
16407
16408/*!
16409 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