diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-04-22 17:21:30 -0400 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-05-14 09:51:56 -0400 |
commit | 65329eb45d2f17d24120e15ba24f257204133b2c (patch) | |
tree | 9730a20d0394dea3a444d54eb8d8a2f1a5a0142a | |
parent | ab1f0fd674ac321f3ce597aebfc7fe2d97fa3cfc (diff) |
svx: support no fill and no stroke paths in PDF import
Change-Id: Ida5daa71d469805fd52e08e804fb9fa182d7d008
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 79cd86d850c1..bb241986a199 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -1410,11 +1410,24 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd float fWidth = 1; FPDFPath_GetStrokeWidth(pPageObject, &fWidth); - SAL_WARN("sd.filter", "Path Stroke Width: " << fWidth); - const double dWidth = fabs(sqrt2(a, c) * fWidth); - SAL_WARN("sd.filter", "Path Stroke Width scaled: " << dWidth); + const double dWidth = 0.5 * fabs(sqrt2(mCurMatrix.a(), mCurMatrix.c()) * fWidth); mnLineWidth = lcl_ToLogic(lcl_PointToPixel(dWidth)); mnLineWidth /= 2; + SAL_WARN("sd.filter", "Path Stroke Width: " << fWidth << ", scaled: " << dWidth + << ", Logical: " << mnLineWidth); + + int nFillMode = FPDF_FILLMODE_ALTERNATE; + FPDF_BOOL bStroke = true; + if (FPDFPath_GetDrawMode(pPageObject, &nFillMode, &bStroke)) + { + SAL_WARN("sd.filter", "Got PATH FillMode: " << nFillMode << ", Storke: " << bStroke); + if (nFillMode == FPDF_FILLMODE_ALTERNATE) + mpVD->SetDrawMode(DrawModeFlags::Default); + else if (nFillMode == FPDF_FILLMODE_WINDING) + mpVD->SetDrawMode(DrawModeFlags::Default); + else + mpVD->SetDrawMode(DrawModeFlags::NoFill); + } unsigned int nR; unsigned int nG; @@ -1424,15 +1437,15 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd 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 (bStroke) + { + 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)); + } + else + mpVD->SetLineColor(COL_TRANSPARENT); // if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) |