[Libreoffice-commits] core.git: include/vcl vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 15 13:41:59 UTC 2020


 include/vcl/filter/PDFiumLibrary.hxx |    2 ++
 vcl/source/pdf/PDFiumLibrary.cxx     |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit c43e4005e7b0f19920a3e50120298391251cf8af
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 14 22:47:51 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Oct 15 15:41:01 2020 +0200

    pdfium: add getColor and getInteriourColor to PDFiumAnnotation
    
    Interiour color is used as a fill color.
    
    Change-Id: If0c55fdaef083001abeb55e5c7ce3bae8d232713
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104360
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 7c01f2f505b0..22602558d0d2 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -94,6 +94,8 @@ public:
     std::unique_ptr<PDFiumPageObject> getObject(int nIndex);
     std::vector<std::vector<basegfx::B2DPoint>> getInkStrokes();
     std::vector<basegfx::B2DPoint> getVertices();
+    Color getColor();
+    Color getInteriorColor();
 };
 
 class PDFiumPage;
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 074863156f97..c5d27316944f 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -465,6 +465,28 @@ basegfx::B2DRectangle PDFiumAnnotation::getRectangle()
     return aB2DRectangle;
 }
 
+Color PDFiumAnnotation::getColor()
+{
+    Color aColor = COL_TRANSPARENT;
+    unsigned int nR, nG, nB, nA;
+    if (FPDFAnnot_GetColor(mpAnnotation, FPDFANNOT_COLORTYPE_Color, &nR, &nG, &nB, &nA))
+    {
+        aColor = Color(0xFF - nA, nR, nG, nB);
+    }
+    return aColor;
+}
+
+Color PDFiumAnnotation::getInteriorColor()
+{
+    Color aColor = COL_TRANSPARENT;
+    unsigned int nR, nG, nB, nA;
+    if (FPDFAnnot_GetColor(mpAnnotation, FPDFANNOT_COLORTYPE_InteriorColor, &nR, &nG, &nB, &nA))
+    {
+        aColor = Color(0xFF - nA, nR, nG, nB);
+    }
+    return aColor;
+}
+
 bool PDFiumAnnotation::hasKey(OString const& rKey)
 {
     return FPDFAnnot_HasKey(mpAnnotation, rKey.getStr());


More information about the Libreoffice-commits mailing list