question about filter/arithmetic
Hi,
I hope it's ok to post the following test case to get your opinion.
It's about filter/arithmetic. I don't get the same result in inkscape and in squiggle (and for me both look wrong)
final filter in inkscape (0.48.3) "does nothing" the result looks 99% like the initial background squiggle is better you see the diagonal but not all pixels are black
I expected every pixel at the top right above the diagonal in final image would be black (as in the included png) because in the top right r image (=g image =b image) > r background so lighter (image,background) = image so k2 * lighter (image,background) + k3 * image with k2 = 1 and k3 = -1 = lighter (image,background) - image = image - image = 0
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="210mm" height="297mm" id="svg2" style="enable-background:new"> <defs id="defs4"> <marker refX="0" refY="0" orient="auto" id="Arrow1Lstart" style="overflow:visible"> <path d="M 0,0 5,-5 -12.5,0 5,5 0,0 z" transform="matrix(0.8,0,0,0.8,10,0)" id="path3998" style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt" /> </marker> <linearGradient id="linearGradient3825"> <stop id="stop3827" style="stop-color:#000000;stop-opacity:1" offset="0" /> <stop id="stop3829" style="stop-color:#fcfcfc;stop-opacity:1" offset="1" /> </linearGradient> <linearGradient id="linearGradient3803"> <stop id="stop3805" style="stop-color:#000000;stop-opacity:1" offset="0" /> <stop id="stop3807" style="stop-color:#ffffff;stop-opacity:1" offset="1" /> </linearGradient> <linearGradient id="linearGradient3789"> <stop id="stop3791" style="stop-color:#00a3a3;stop-opacity:1" offset="0" /> <stop id="stop3793" style="stop-color:#eb2e2e;stop-opacity:1" offset="1" /> </linearGradient> <linearGradient id="linearGradient3782"> <stop id="stop3784" style="stop-color:#000000;stop-opacity:1" offset="0" /> <stop id="stop3786" style="stop-color:#ffffff;stop-opacity:0" offset="1" /> </linearGradient> <filter color-interpolation-filters="sRGB" id="filter3852"> <feBlend in2="BackgroundImage" mode="lighten" result="result1" id="feBlend3854" /> </filter> <linearGradient x1="1.4285808" y1="523.79077" x2="-11.428548" y2="1038.0765" id="linearGradient3891" xlink:href="#linearGradient3803" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.16470586,0,0,0.27184464,229.14324,-76.018811)" /> <linearGradient x1="-152.73392" y1="1049.4775" x2="121.55181" y2="768.04895" id="linearGradient3912" xlink:href="#linearGradient3825" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.56000038,0,0,0.53846205,104.56851,-359.58241)" /> <linearGradient x1="-152.73392" y1="1049.4775" x2="121.55181" y2="768.04895" id="linearGradient4520" xlink:href="#linearGradient3825" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.56000038,0,0,0.53846205,455.96089,-153.00324)" /> <linearGradient x1="1.4285808" y1="523.79077" x2="-11.428548" y2="1038.0765" id="linearGradient4541" xlink:href="#linearGradient3803" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.16470586,0,0,0.27184464,399.2299,120.53231)" /> <filter color-interpolation-filters="sRGB" id="filter4543"> <feBlend in2="BackgroundImage" mode="lighten" result="result1" id="feBlend4545" /> <feComposite in2="SourceGraphic" operator="arithmetic" k1="0" k2="1" k3="-1" k4="0" result="result3" id="feComposite4547" /> </filter> <linearGradient x1="-152.73392" y1="1049.4775" x2="121.55181" y2="768.04895" id="linearGradient4633" xlink:href="#linearGradient3825" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.56000038,0,0,0.53846205,450.57867,88.274736)" /> <linearGradient x1="1.4285808" y1="523.79077" x2="-11.428548" y2="1038.0765" id="linearGradient4654" xlink:href="#linearGradient3803" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.16470586,0,0,0.27184464,393.42895,361.83833)" /> </defs> <metadata id="metadata7"> rdf:RDF <cc:Work rdf:about=""> dc:formatimage/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> dc:title</dc:title> </cc:Work> </rdf:RDF> </metadata> <g id="layer1"> <text x="12.380551" y="23.27586" id="text3864" xml:space="preserve"
style="font-size:25.86087418px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="12.380551" y="23.27586" id="tspan3866">Foreground</tspan></text> <text x="201.89806" y="28.043221" id="text3868" xml:space="preserve"
style="font-size:26.65829849px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="201.89806" y="28.043221" id="tspan3870">background</tspan></text> <rect width="159.99998" height="159.99998" x="197.14323" y="60.933994" id="rect3889"
style="fill:url(#linearGradient3891);fill-opacity:1;stroke:#000000;stroke-width:0.002116;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> <rect width="160.00011" height="160.00015" x="15.837464" y="50.905853" id="rect3910"
style="fill:url(#linearGradient3912);fill-opacity:1;stroke:#000000;stroke-width:0.00549126;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> <text x="416.18378" y="243.75751" id="text3926" xml:space="preserve"
style="font-size:26.65829849px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="416.18378" y="243.75751" id="tspan3928">result</tspan></text> <text x="131.42857" y="279.50504" id="text3946" xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="131.42857" y="279.50504" id="tspan3948">Lighter</tspan></text> <path d="M 361.18412,307.15363 C 179.92756,210.18279 179.92756,210.18279 179.92756,210.18279" id="path3992"
style="fill:none;stroke:#000000;stroke-width:1.17201114px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart)" /> <rect width="159.99998" height="159.99998" x="367.22989" y="257.48514" id="rect4539"
style="fill:url(#linearGradient4541);fill-opacity:1;stroke:#000000;stroke-width:0.002116;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> <rect width="160.00011" height="160.00015" x="367.22983" y="257.48505" id="rect4518"
style="fill:url(#linearGradient4520);fill-opacity:1;stroke:#000000;stroke-width:0.00549126;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;filter:url(#filter3852)" /> <path d="M 360,292.36218 C 271.05893,198.07647 271.05893,198.07647 271.05893,198.07647" id="path4568"
style="fill:none;stroke:#000000;stroke-width:0.80954015px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart)" /> <text x="32.857143" y="508.07642" id="text4570" xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="32.857143" y="508.07642" id="tspan4572">Arithmetic</tspan></text> <path d="M 327.05686,576.56189 C 147.67542,435.65073 354.98058,392.72 355.8003,411.73391" id="path4587"
style="fill:none;stroke:#000000;stroke-width:1.17201114px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart)" /> <path d="M 297.78151,578.71513 C 64.36134,213.86639 64.36134,213.86639 64.36134,213.86639" id="path4602"
style="fill:none;stroke:#000000;stroke-width:2.57982302px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart)" /> <text x="255.77797" y="425.70889" id="text4604" xml:space="preserve"
style="font-size:34.79435349px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="255.77797" y="425.70889" id="tspan4606">*1</tspan></text> <text x="153.17693" y="438.31036" id="text4608" xml:space="preserve"
style="font-size:26.20664597px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="153.17693" y="438.31036" id="tspan4610">*-1</tspan></text> <rect width="159.99998" height="159.99998" x="361.42892" y="498.79114" id="rect4652"
style="fill:url(#linearGradient4654);fill-opacity:1;stroke:#000000;stroke-width:0.002116;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> <image
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAABBxJREFU eJztWmFzwyAIRYO2///vbuo+4aFRRNvMtSt3vUVrDO/5QGJnjDHJGANkKSWoLaUEfEyvj5v0Xe/7 3j0rc2nuAwAwAHBGrJyoRdarmTHGvD6KSePqtZt92WJc0f+SAG4fAnY7sNs+BOx2YLd9CNjtwG77 ELDbgd32IWC3A7vtQ8BuB3bbh4DdDuy2f0/A6UhMc472ToaICCml/CGj63cnBL33AAAQY4QQAsQY M3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APaB2qgdkBkDdHvU/OlY7H8eDdME7R04826nftNPvAnQh ETAz4czPUnXe0MzB5T0zB7UpUdMcP/B0mch1Dn4EAAAAAElFTkSuQmCC " x="566.51538" y="497.10315" width="162.99495" height="162.99495" id="image4674" /> <rect width="160.00011" height="160.00015" x="361.84763" y="498.76306" id="rect4631"
style="fill:url(#linearGradient4633);fill-opacity:1;stroke:#000000;stroke-width:0.00549126;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;filter:url(#filter4543)" /> <text x="382.57211" y="537.15765" id="text4660" xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#f64a00;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="382.57211" y="537.15765" id="tspan4662">KO</tspan></text> <text x="439.14066" y="534.1272" id="text4689" xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#f64a00;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="439.14066" y="534.1272" id="tspan4691">!= Expected</tspan></text> <text x="415.90714" y="321.99515" id="text4705" xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#f64a00;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="415.90714" y="321.99515" id="tspan4707">OK</tspan></text> <text x="479.18304" y="428.90924" transform="scale(0.77351912,1.2927929)" id="text4851" xml:space="preserve"
style="font-size:10.02463627px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#f64a00;fill-opacity:1;stroke:none;font-family:Nimbus Mono L;-inkscape-font-specification:Nimbus Mono L"><tspan x="479.18304" y="428.90924" id="tspan4853">in Inkscape 0.48.3.1 r9886 </tspan><tspan x="479.18304" y="441.44003" id="tspan5969">it looks like the background </tspan></text> </g> </svg>
Thank you
participants (1)
-
pennec victor