Closed lukas-kirschner closed 11 months ago
I tried to find the source of this bug and added a fill and stroke color override property to set both separately (see PR #85 ). I attached a minimal example SVG that renders incorrectly when setting either OverrideColor
or OverrideFillColor
- When overriding the fill color, the path at the bottom gets filled even though no fill color has been set for it.
I tried to find the source of this bug and added a fill and stroke color override property to set both separately
I do not know what the expected result is. This is a polyline path, and I do not expect it to be filled.
However, setting the OverrideColor
property forces a fill. 🙄
Some contributed PR are not well tested, that is why I added the develop branch and PR check list.
Features like the OverrideColor
are not part of the specifications and should be well-documented and tested.
The PathShape
has a ClosedPath
property, but I do not see how this is set or used - you can look into this.
@jogibear9988 is no longer actively working on this project, and I am only contributing to keep it alive for those
using it - I do not use it or C# in my current work.
Thanks for your reply - Ok, I am going to write some unit tests and documentation for the properties and switch off the PR draft mode when I am done. I'll add some documentation for the new properties to the Docs folder. I tried to debug the issue, but had no luck so far. I suspect there are some shape properties in the renderer class that are discarded when the color is overridden... but I could not pinpoint the issue yet.
I think this should fix the issue. If the result below is what you are expecting.
Attached are the fixed SVGRender.cs
file and the updated SvgTestBox
shown above, which I used to test the overridable properties (color and stroke width).
If these work as you expect, then consider merging these sources with yours and updating your PR.
Great, thanks! I merged your changes and everything works perfectly 👍 I pushed everything to the PR and added an option for overriding stroke and fill color to the TestBox UI:
Is your feature request related to a problem? Please describe. In my project, I am changing SVGImage stroke colors using the OverrideColor dependency property. However, when my SVGs consist of strokes without any fill color, both the fill color and the stroke is overridden by the OverrideColor. A temporary workaround is to change the stroke to a fill using the "Stroke to Path" feature of Inkscape. This solution is not optimal, because it discards information about the original stroke.
Describe the solution you'd like This might be fixed by either keeping transparent colors intact when overriding colors, or by offering a separate "OverrideFillColor" property that can be used to override the fill color.