aboutsummaryrefslogtreecommitdiff
path: root/notebookview.cc
diff options
context:
space:
mode:
Diffstat (limited to 'notebookview.cc')
-rw-r--r--notebookview.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/notebookview.cc b/notebookview.cc
index 2bca4f7..f433664 100644
--- a/notebookview.cc
+++ b/notebookview.cc
@@ -88,6 +88,34 @@ void NotebookView::setZoom(int zoom)
}
}
+QSize NotebookView::getCurPageSize() const
+{
+ return _nb->getPageSize(_curPage);
+}
+
+QRect NotebookView::getCurPageTrim() const
+{
+ return _nb->getPageTrim(_curPage);
+}
+
+QImage NotebookView::exportPage(int pageNum) const
+{
+ const QRect pageTrim = getCurPageTrim();
+ QImage image(pageTrim.width() / 4, pageTrim.height() / 4, QImage::Format_RGB32);
+ QPainter painter(&image);
+ painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ renderPage(&painter, pageNum, QRectF(), pageTrim);
+ return image;
+}
+
+void NotebookView::renderPage(QPainter *painter, int pageNum, const QRectF &target, const QRectF &source) const
+{
+ QGraphicsScene scene;
+ PageItem *item = new PageItem(_nb, 0, pageNum);
+ scene.addItem(item);
+ scene.render(painter, target, source, Qt::KeepAspectRatio);
+}
+
void NotebookView::requestPaperReplay(const QString &file, qint64 time)
{
emit paperReplayRequested(file, time);