summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-07-06 14:08:23 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-07-08 20:55:01 +0200
commitbc8016b81c2c609711c26af1f85da327cf30a4ff (patch)
tree40155b9e9cc116af7fcabbd5996aac756f96384e /vcl
parent243b96653e0f5d1113521129baecb4e1c278cc83 (diff)
pdf: add PDFiumPathSegment to the wrapper & use in ImpSdrPdfImport
A PageObject of type FPDF_PAGEOBJ_PATH can have a path segment, that is common in vector graphic objects. The path segment is wrapped into PDFiumPathSegment which can be used to handle the path and path properties. Change-Id: I990d51ba90fa356a6eca137eb4b71947858289aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98210 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index b58878e7881e..d77a2f8da663 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -315,6 +315,39 @@ Color PDFiumPageObject::getStrokeColor()
return aColor;
}
+int PDFiumPageObject::getPathSegmentCount() { return FPDFPath_CountSegments(mpPageObject); }
+
+std::unique_ptr<PDFiumPathSegment> PDFiumPageObject::getPathSegment(int index)
+{
+ std::unique_ptr<PDFiumPathSegment> pPDFiumPathSegment;
+ FPDF_PATHSEGMENT pPathSegment = FPDFPath_GetPathSegment(mpPageObject, index);
+ if (pPathSegment)
+ {
+ pPDFiumPathSegment = std::make_unique<PDFiumPathSegment>(pPathSegment);
+ }
+ return pPDFiumPathSegment;
+}
+
+PDFiumPathSegment::PDFiumPathSegment(FPDF_PATHSEGMENT pPathSegment)
+ : mpPathSegment(pPathSegment)
+{
+}
+
+PDFiumPathSegment::~PDFiumPathSegment() {}
+
+basegfx::B2DPoint PDFiumPathSegment::getPoint()
+{
+ basegfx::B2DPoint aPoint;
+ float fx, fy;
+ if (FPDFPathSegment_GetPoint(mpPathSegment, &fx, &fy))
+ aPoint = basegfx::B2DPoint(fx, fy);
+ return aPoint;
+}
+
+bool PDFiumPathSegment::isClosed() { return FPDFPathSegment_GetClose(mpPathSegment); }
+
+int PDFiumPathSegment::getType() { return FPDFPathSegment_GetType(mpPathSegment); }
+
PDFiumAnnotation::PDFiumAnnotation(FPDF_ANNOTATION pAnnotation)
: mpAnnotation(pAnnotation)
{