summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-04-13 18:59:56 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-01 08:59:16 +0200
commite034d51d5312184a6d5d8ffb1e4c53d553376aed (patch)
tree81b6ece9f805c5b8fd39d91f5d1bafffec90ce1f /svx
parentaf97fa7dfa540386683f0c4ac14e976f05894a3d (diff)
svx: improve path importing from PDF
Change-Id: I8e63b2a35d841e065ef32fea95c0a5f22ca6f049
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdpdf.cxx39
1 files changed, 28 insertions, 11 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 15759a6a17eb..721959296837 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -568,7 +568,7 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
if (mpVD->IsLineColor())
{
- mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID));
+ mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID)); //TODO support dashed lines.
mpLineAttr->Put(XLineColorItem(OUString(), mpVD->GetLineColor()));
}
else
@@ -1253,6 +1253,10 @@ void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT pPageObject, int nPageObjectIn
void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectIndex)
{
SAL_WARN("sd.filter", "Got page object PATH: " << nPageObjectIndex);
+
+ double a, b, c, d, e, f;
+ FPDFPath_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
+
basegfx::B2DPolygon aPoly;
std::vector<basegfx::B2DPoint> aBezier;
@@ -1269,9 +1273,14 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
continue;
}
+ SAL_WARN("sd.filter", "Got point (" << x << ", " << y << ")");
+
+ x = a * x + c * y + e;
+ y = b * x + d * y + f;
+
const bool bClose = FPDFPathSegment_GetClose(pPathSegment);
SAL_WARN("sd.filter",
- "Got (" << x << ", " << y << "): " << (bClose ? "CLOSE" : "OPEN"));
+ "Point corrected (" << x << ", " << y << "): " << (bClose ? "CLOSE" : "OPEN"));
Point aPoint = PointsToLogic(x, y);
x = aPoint.X();
y = aPoint.Y();
@@ -1321,15 +1330,23 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
FPDFPath_GetStrokeWidth(pPageObject, &fWidth);
mnLineWidth = lcl_ToLogic(lcl_PointToPixel(fWidth));
- unsigned int r;
- unsigned int g;
- unsigned int b;
- unsigned int a;
- FPDFPath_GetFillColor(pPageObject, &r, &g, &b, &a);
- mpVD->SetFillColor(Color(r, g, b));
-
- FPDFPath_GetStrokeColor(pPageObject, &r, &g, &b, &a);
- mpVD->SetLineColor(Color(r, g, b));
+ unsigned int nR;
+ unsigned int nG;
+ unsigned int nB;
+ unsigned int nA;
+ FPDFPath_GetFillColor(pPageObject, &nR, &nG, &nB, &nA);
+ SAL_WARN("sd.filter", "Got PATH fill color: " << nR << ", " << nG << ", " << nB << ", " << nA);
+ mpVD->SetFillColor(Color(nR, nG, nB));
+
+ FPDFPath_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
+ SAL_WARN("sd.filter",
+ "Got PATH stroke color: " << nR << ", " << nG << ", " << nB << ", " << nA);
+ mpVD->SetLineColor(Color(nR, nG, nB));
+
+ // int nFillMode = 0; // No fill.
+ // bool bStroke = false;
+ // FPDFPath_GetDrawMode(pPageObject, &nFillMode, &bStroke);
+ // mpVD->Setstroke(Color(r, g, b));
// if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))