зеркало из https://github.com/SixLabors/Shapes.git
offset per path causing drift
This commit is contained in:
Родитель
a8ad9680fd
Коммит
27f4867875
|
@ -0,0 +1,317 @@
|
|||
<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="224.1651mm"
|
||||
height="224.1651mm"
|
||||
viewBox="0 0 794.28579 794.28578"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:export-filename="C:\Source\SixLabors.Fonts\icons\icon.png"
|
||||
inkscape:export-xdpi="14.503596"
|
||||
inkscape:export-ydpi="14.503596">
|
||||
<title
|
||||
id="title4355">logo.svg</title>
|
||||
<defs
|
||||
id="defs4">
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter6525">
|
||||
<feFlood
|
||||
flood-opacity="0.498039"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood6527" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite6529" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="5"
|
||||
result="blur"
|
||||
id="feGaussianBlur6531" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset6533" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite6535" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:label="Inset"
|
||||
inkscape:menu="Shadows and Glows"
|
||||
inkscape:menu-tooltip="Shadowy outer bevel"
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter4317">
|
||||
<feMorphology
|
||||
result="result1"
|
||||
in="SourceAlpha"
|
||||
operator="dilate"
|
||||
radius="3.6"
|
||||
id="feMorphology4319" />
|
||||
<feGaussianBlur
|
||||
stdDeviation="3.6"
|
||||
in="result1"
|
||||
result="result0"
|
||||
id="feGaussianBlur4321" />
|
||||
<feDiffuseLighting
|
||||
surfaceScale="-5"
|
||||
id="feDiffuseLighting4323">
|
||||
<feDistantLight
|
||||
elevation="45"
|
||||
azimuth="225"
|
||||
id="feDistantLight4325" />
|
||||
</feDiffuseLighting>
|
||||
<feComposite
|
||||
in2="result0"
|
||||
operator="in"
|
||||
result="result91"
|
||||
id="feComposite4327" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="result91"
|
||||
id="feComposite4329" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter4331">
|
||||
<feFlood
|
||||
flood-opacity="0.498039"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood4333" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite4335" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="5"
|
||||
result="blur"
|
||||
id="feGaussianBlur4337" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset4339" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite4341" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter4331-9">
|
||||
<feFlood
|
||||
flood-opacity="0.498039"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood4333-7" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite4335-9" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="5"
|
||||
result="blur"
|
||||
id="feGaussianBlur4337-6" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset4339-9" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="over"
|
||||
result="composite2"
|
||||
id="feComposite4341-9" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:label="Inset"
|
||||
inkscape:menu="Shadows and Glows"
|
||||
inkscape:menu-tooltip="Shadowy outer bevel"
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter4317-0">
|
||||
<feMorphology
|
||||
result="result1"
|
||||
in="SourceAlpha"
|
||||
operator="dilate"
|
||||
radius="3.6"
|
||||
id="feMorphology4319-1" />
|
||||
<feGaussianBlur
|
||||
stdDeviation="3.6"
|
||||
in="result1"
|
||||
result="result0"
|
||||
id="feGaussianBlur4321-9" />
|
||||
<feDiffuseLighting
|
||||
surfaceScale="-5"
|
||||
id="feDiffuseLighting4323-0">
|
||||
<feDistantLight
|
||||
elevation="45"
|
||||
azimuth="225"
|
||||
id="feDistantLight4325-1" />
|
||||
</feDiffuseLighting>
|
||||
<feComposite
|
||||
in2="result0"
|
||||
operator="in"
|
||||
result="result91"
|
||||
id="feComposite4327-1" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="result91"
|
||||
id="feComposite4329-4" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.35"
|
||||
inkscape:cx="-74.351985"
|
||||
inkscape:cy="872.05831"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-center="true"
|
||||
inkscape:snap-object-midpoints="true" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>logo.svg</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(25.095642,-129.03821)">
|
||||
<path
|
||||
style="opacity:1;fill:#ffd42a;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 228.7026,163.94011 478.42063,308.11495 353.56157,380.20231 228.7026,452.28969 Z"
|
||||
id="path4138-4-42-3-7-2-4-1-1-0-1"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:1;fill:#800080;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 515.44487,900.62588 265.72694,756.45114 515.44495,612.2764 Z"
|
||||
id="path4138-4-4-04-1-5-5-4-8-4-0-2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
style="opacity:1;fill:#d40000;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 764.3404,594.60454 -249.71787,144.17474 -5e-5,-144.17464 0,-144.17476 z"
|
||||
id="path4138-4-0-6-1-5-9-2-8"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:1;fill:#ff6600;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 621.54012,223.63736 0,288.34938 -124.85894,-72.08726 -124.85904,-72.08735 z"
|
||||
id="path4138-4-42-7-1-8-5-8-8-4"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:1;fill:#88aa00;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M -19.874234,468.81935 229.84379,324.6446 l 0,144.17475 0,144.17474 z"
|
||||
id="path4138-4-4-4-1-4-9-0-2-6"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:1;fill:#000080;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 122.22973,839.69293 0,-288.3496 124.8589,72.08748 124.85897,72.08736 -124.8589,72.08737 z"
|
||||
id="path4138-4-4-04-6-7-6-0-8-1-5"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
<g
|
||||
id="g4314"
|
||||
transform="matrix(-0.21879989,0.37897254,-0.37897254,-0.21879989,-244.80122,1390.7319)">
|
||||
<path
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-42-3-7-2-4-1-1-0-1-3-5"
|
||||
d="m -2405.4054,-614.67631 324.4085,187.29744 -162.2042,93.64865 -162.2043,93.64866 -131.2183,-225.02695 z"
|
||||
style="opacity:1;fill:#ffd42a;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-4-04-1-5-5-4-8-4-0-2-8-3"
|
||||
d="m -2404.7567,135.61002 -324.4084,-187.297333 324.4085,-187.297317 z"
|
||||
style="opacity:1;fill:#800080;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-0-6-1-5-9-2-8-4-7"
|
||||
d="m -2080.3771,-51.711273 -324.4083,187.297293 -10e-5,-187.297163 0,-187.297307 z"
|
||||
style="opacity:1;fill:#d40000;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-42-7-1-8-5-8-8-4-3-0"
|
||||
d="m -2080.9937,-427.37825 0,374.594487 -162.2041,-93.648527 -162.2043,-93.64865 z"
|
||||
style="opacity:1;fill:#ff6600;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-4-4-1-4-9-0-2-6-5-4"
|
||||
d="m -2729.8142,-427.37689 324.4085,-187.29731 0,187.29731 0,187.29731 z"
|
||||
style="opacity:1;fill:#88aa00;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4138-4-4-04-6-7-6-0-8-1-5-3-6"
|
||||
d="m -2729.1928,-51.708663 0,-374.594747 162.2041,93.64878 162.2043,93.64866 -162.2041,93.64865 z"
|
||||
style="opacity:1;fill:#000080;fill-opacity:1;stroke-width:12.48351002;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
</g>
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:45.68399811;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter4317);color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 365.01001,321.96934 -157.91942,91.17637 0.25346,39.43928 0.24237,143.22475 158.14844,91.13413 157.93055,-91.18304 -0.0401,-12.58909 -0.40244,-121.75971 0.25568,-0.14898 -0.0399,-12.58908 -0.32685,-20.71574 -0.049,-14.52569 -0.18232,-0.10667 -0.005,-0.22235 -157.86607,-91.13413 z m 0.18678,50.49421 112.60138,65.00654 -112.27231,64.81977 -112.70145,-64.94652 112.37238,-64.87979 z m -114.34901,113.8843 114.70031,66.09826 114.30676,-65.99599 0.28016,84.27485 -114.42238,66.06267 -114.72255,-66.10938 -0.1423,-84.33041 z"
|
||||
id="path4138-4-42-3-7-2-4-1-1-0-1-3-5-8"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="matrix(1.1867576,0,0,1.1867576,-63.06402,-69.61051)" />
|
||||
</g>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 12 KiB |
|
@ -173,8 +173,7 @@ namespace SixLabors.Shapes
|
|||
int totalAdded = 0;
|
||||
for (int i = 0; i < this.paths.Length; i++)
|
||||
{
|
||||
offset += totalAdded;
|
||||
int added = this.paths[i].FindIntersections(start, end, buffer, offset);
|
||||
int added = this.paths[i].FindIntersections(start, end, buffer, totalAdded + offset);
|
||||
totalAdded += added;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace SixLabors.Shapes
|
|||
EndType type = p.IsClosed ? EndType.etClosedLine : EndType.etOpenButt;
|
||||
|
||||
|
||||
offset.AddPath(points, JoinType.jtMiter, type);
|
||||
offset.AddPath(points, JoinType.jtSquare, type);
|
||||
}
|
||||
|
||||
return ExecuteOutliner(width, offset);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using SixLabors.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace SixLabors.Shapes.Tests.Issues
|
||||
{
|
||||
public class Issue_ClippedPaths
|
||||
{
|
||||
[Fact]
|
||||
public void ClippedTriangle()
|
||||
{
|
||||
Polygon simplePath = new Polygon(new LinearLineSegment(
|
||||
new PointF(10, 10),
|
||||
new PointF(200, 150),
|
||||
new PointF(50, 300)));
|
||||
|
||||
Polygon hole1 = new Polygon(new LinearLineSegment(
|
||||
new PointF(37, 85),
|
||||
new PointF(93, 85),
|
||||
new PointF(65, 137)));
|
||||
|
||||
var clippedPath = simplePath.Clip(hole1);
|
||||
var outline = clippedPath.GenerateOutline(5, new[] { 1f });
|
||||
|
||||
Assert.False(outline.Contains(new PointF(74, 97)));
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче