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-08-01 08:30:27 +0200
commit7cbb10598d6b1a0f5e0d612eb6ffc1df28d086e4 (patch)
treeb9caba4afb341cd71f505716d27f8997af68a466 /vcl
parent7e02d0e4f22aa362184a5ac634eb916383f3f3d5 (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. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98210 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit bc8016b81c2c609711c26af1f85da327cf30a4ff) Change-Id: I990d51ba90fa356a6eca137eb4b71947858289aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99879 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@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 e86b7565dd1b..caf1bd27eefb 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)
{