poppler/CairoOutputDev.cc | 13 ++++++++++--- qt5/tests/check_stroke_opacity.cpp | 11 +++++++++++ utils/pdftocairo.cc | 7 ++++--- 3 files changed, 25 insertions(+), 6 deletions(-)
New commits: commit 02ec7a70a7a3c654bd94898633f6552fc7eae8b9 Author: Oliver Sander <[email protected]> Date: Tue Apr 28 09:07:41 2020 +0200 Add additional render tests The file stroke-alpha-pattern.pdf contains a third shape. It is rendered correctly by all backends, but as the infrastructure is in place we may as well add a quick test for that. diff --git a/qt5/tests/check_stroke_opacity.cpp b/qt5/tests/check_stroke_opacity.cpp index b4cff022..3857a3a7 100644 --- a/qt5/tests/check_stroke_opacity.cpp +++ b/qt5/tests/check_stroke_opacity.cpp @@ -82,6 +82,17 @@ void TestStrokeOpacity::checkStrokeOpacity() tolerance = 2; QVERIFY(approximatelyEqual(pixelUpperLeftOnStroke, QColor(253,233,196,255))); + + // At the upper right there is a semi-transparent stroked red square + // a) Make sure that the color is correct. + auto pixelUpperRightOnStroke = image.pixel(130,20); + + tolerance = 0; + QVERIFY(approximatelyEqual(pixelUpperRightOnStroke, QColor(246,196,206,255))); + + // b) Make sure that it is really stroked, not filled + auto pixelUpperRightInterior = image.pixel(130,50); + QVERIFY(approximatelyEqual(pixelUpperRightInterior, Qt::white)); } QTEST_GUILESS_MAIN(TestStrokeOpacity) commit d500783fafd9884415005a27641c9b4d49cfe3e4 Author: Oliver Sander <[email protected]> Date: Tue Apr 28 08:21:25 2020 +0200 [cairo] Mention opacity when logging fill color stops diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index da41a23c..63e49c7a 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -597,8 +597,8 @@ void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) { colToDbl(fill_color.g), colToDbl(fill_color.b), opacity); - LOG(printf ("fill color stop: %f (%d, %d, %d)\n", - offset, fill_color.r, fill_color.g, fill_color.b)); + LOG(printf ("fill color stop: %f (%d, %d, %d, %d)\n", + offset, fill_color.r, fill_color.g, fill_color.b, dblToCol(opacity))); } void CairoOutputDev::updateBlendMode(GfxState *state) { commit c2f914359cdc672288d6cd68f157921214e536fa Author: Oliver Sander <[email protected]> Date: Tue Apr 28 08:19:26 2020 +0200 [cairo] Use stroke opacity when clipping to a stroke path Fixes: https://gitlab.freedesktop.org/poppler/poppler/issues/178 diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 34c02667..da41a23c 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -33,6 +33,7 @@ // Copyright (C) 2018, 2020 Adam Reichold <[email protected]> // Copyright (C) 2019 Marek Kasik <[email protected]> // Copyright (C) 2020 Michal <[email protected]> +// Copyright (C) 2020 Oliver Sander <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -585,11 +586,17 @@ void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) { state->getFillRGB(&fill_color); + // If stroke pattern is set then the current fill is clipped + // to a stroke path. In that case, the stroke opacity has to be used + // rather than the fill opacity. + // See https://gitlab.freedesktop.org/poppler/poppler/issues/178 + auto opacity = (state->getStrokePattern()) ? state->getStrokeOpacity() : state->getFillOpacity(); + cairo_pattern_add_color_stop_rgba(fill_pattern, offset, colToDbl(fill_color.r), colToDbl(fill_color.g), colToDbl(fill_color.b), - fill_opacity); + opacity); LOG(printf ("fill color stop: %f (%d, %d, %d)\n", offset, fill_color.r, fill_color.g, fill_color.b)); } commit 7c890b37ac70394cb330e9d9615ad9532769c9e0 Author: Oliver Sander <[email protected]> Date: Tue Apr 28 08:13:08 2020 +0200 Fix typo in variable name diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index e522ea8f..af07a9e5 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -34,6 +34,7 @@ // Copyright (C) 2018 Adam Reichold <[email protected]> // Copyright (C) 2019, 2020 Oliver Sander <[email protected]> // Copyright (C) 2019 Kris Jurka <[email protected]> +// Copyright (C) 2020 Oliver Sander <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -290,13 +291,13 @@ static int icc_data_size; static cmsHPROFILE profile; #endif -struct AntiliasOption +struct AntialiasOption { const char *name; cairo_antialias_t value; }; -static const AntiliasOption antialiasOptions[] = +static const AntialiasOption antialiasOptions[] = { { "default", CAIRO_ANTIALIAS_DEFAULT }, { "none", CAIRO_ANTIALIAS_NONE }, @@ -310,7 +311,7 @@ static const AntiliasOption antialiasOptions[] = static bool parseAntialiasOption() { - const AntiliasOption *option = antialiasOptions; + const AntialiasOption *option = antialiasOptions; while (option->name) { if (antialias.cmp(option->name) == 0) { antialiasEnum = option->value; _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
