|
wiRedPanda
Logic Circuit Simulator
|
Pure render functions for exporting a circuit scene to image formats. More...
Functions | |
| static QRectF | paddedBoundingRect (Scene *scene) |
| QImage | renderScaledImage (Scene *scene, const QRectF &paddedRect) |
| Renders scene into a transparent-filled QImage bounded by kMaxImageDimension. | |
| void | renderToImage (Scene *scene, const QString &filePath) |
| Renders scene to a PNG image file at filePath. | |
| void | renderToPdf (Scene *scene, const QString &filePath) |
| Renders scene to a PDF file at filePath. | |
Variables | |
| constexpr double | kMaxImageDimension = 4096 |
Pure render functions for exporting a circuit scene to image formats.
Owns only the rendering step (QPrinter / QPixmap + QPainter). File-dialog interaction and status-bar updates remain in MainWindow. Both functions add a 64 px margin around the scene bounding rectangle.
|
static |
Definition at line 22 of file CircuitExporter.cpp.
Referenced by renderToImage(), and renderToPdf().
| QImage CircuitExporter::renderScaledImage | ( | Scene * | scene, |
| const QRectF & | paddedRect ) |
Renders scene into a transparent-filled QImage bounded by kMaxImageDimension.
paddedRect is scene-coordinate content to render (caller applies its own padding policy). Content is scaled down to fit within kMaxImageDimension per side rather than allocated proportionally to paddedRect. Shared by renderToImage() and the MCP export_image handler so this bounding logic has exactly one implementation.
| Pandaception | if the QPainter cannot begin painting to the image. |
Definition at line 46 of file CircuitExporter.cpp.
References kMaxImageDimension, and PANDACEPTION_WITH_CONTEXT.
Referenced by renderToImage().
| void CircuitExporter::renderToImage | ( | Scene * | scene, |
| const QString & | filePath ) |
Renders scene to a PNG image file at filePath.
Output resolution matches the scene extent 1:1 up to kMaxImageDimension; larger scenes are scaled down to fit rather than allocating proportionally.
Definition at line 85 of file CircuitExporter.cpp.
References paddedBoundingRect(), PANDACEPTION_WITH_CONTEXT, and renderScaledImage().
Referenced by ExportController::exportImageDialog().
| void CircuitExporter::renderToPdf | ( | Scene * | scene, |
| const QString & | filePath ) |
Renders scene to a PDF file at filePath.
| Pandaception | if the QPainter cannot begin painting to the printer. |
Definition at line 27 of file CircuitExporter.cpp.
References paddedBoundingRect(), and PANDACEPTION_WITH_CONTEXT.
Referenced by ExportController::exportPdfDialog().
|
inlineconstexpr |
Maximum width/height (in pixels) renderToImage() will allocate. Scene extent beyond this is scaled down to fit rather than sized proportionally — see renderToImage()'s details. Bounded well under 8192 (where width*height*4 bytes hits Qt's own default 256 MB QImageIOHandler allocation limit — confirmed via debugger inspection: a 16384 cap produced an image QImage's own reader then refused to load back), so the exported file stays usable by any default-configured Qt image consumer, not just by this process's writer.
Definition at line 31 of file CircuitExporter.h.
Referenced by renderScaledImage().