From 1c0aecbbe0ede58e567a18900fe61078cbce107c Mon Sep 17 00:00:00 2001 From: Damir Porobic Date: Sat, 9 May 2020 00:01:28 +0200 Subject: [PATCH] Export items out of scene rect #90 --- CHANGELOG.md | 1 + src/annotations/core/AnnotationArea.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91bb4656..38e8bba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Release 0.3.0 * New: Tabs for images. ([#48](https://github.com/ksnip/kImageAnnotator/issues/48)) * New: Add option to translate UI. ([#54](https://github.com/ksnip/kImageAnnotator/issues/54)) +* New: Saved image expand to include annotations out of border. ([#90](https://github.com/ksnip/kImageAnnotator/issues/90)) ## Release 0.2.1 * Fixed: Edit border around text box doesn't disappear when done with editing. ([#71](https://github.com/ksnip/kImageAnnotator/issues/71)) diff --git a/src/annotations/core/AnnotationArea.cpp b/src/annotations/core/AnnotationArea.cpp index 7e1ecf1d..ced445b7 100644 --- a/src/annotations/core/AnnotationArea.cpp +++ b/src/annotations/core/AnnotationArea.cpp @@ -94,13 +94,17 @@ QImage AnnotationArea::image() mItemModifier->clear(); + setSceneRect({}); // Unset scene rect to cover all items + QImage image(sceneRect().size().toSize(), QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::transparent); + image.fill(Qt::white); QPainter painter(&image); painter.setRenderHint(QPainter::Antialiasing); render(&painter); + setSceneRect(mImage->boundingRect()); // Reset scene rect + return image; }