Editor plugin: Image

This commit is contained in:
Jakub Melka
2024-06-15 16:03:54 +02:00
parent 05cf65b381
commit aa92fabd79
5 changed files with 74 additions and 5 deletions

View File

@ -226,7 +226,7 @@ bool EditorPlugin::save()
const pdf::PDFPageContentImageElement* elementImage = element->asElementImage();
const pdf::PDFPageContentElementTextBox* elementTextBox = element->asElementTextBox();
// TODO: Impelement all things
// TODO: Implement all things
if (editedElement)
{
@ -263,11 +263,35 @@ bool EditorPlugin::save()
contentStreamBuilder.writeStyledPath(path, elementLine->getPen(), elementLine->getBrush(), true, false);
}
if (elementDot)
{
QPen pen = elementDot->getPen();
const qreal radius = pen.widthF() * 0.5;
QPainterPath path;
path.addEllipse(elementDot->getPoint(), radius, radius);
contentStreamBuilder.writeStyledPath(path, Qt::NoPen, QBrush(pen.color()), false, true);
}
if (elementFreehandCurve)
{
QPainterPath path = elementFreehandCurve->getCurve();
contentStreamBuilder.writeStyledPath(path, elementFreehandCurve->getPen(), elementFreehandCurve->getBrush(), true, false);
}
if (elementImage)
{
QImage image = elementImage->getImage();
if (!image.isNull())
{
contentStreamBuilder.writeImage(image, elementImage->getRectangle());
}
else
{
// It is probably an SVG image
}
}
}
}