summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-10-14 22:47:51 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-15 15:41:01 +0200
commitc43e4005e7b0f19920a3e50120298391251cf8af (patch)
tree5e5583f92c47a7db2871c602bfd1c74e576cef63
parent1e383097aa929176bac33f46787e16d945a0a98b (diff)
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@gmail.com>
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx2
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx22
2 files changed, 24 insertions, 0 deletions
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());