Code Monkey home page Code Monkey logo

svgtoxaml's People

Contributors

adrianhara avatar berndk avatar hytonevi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svgtoxaml's Issues

How to use in code behind

Hi, I found we can use in xaml like:
<Image Source="{StaticResource cloud_3_iconDrawingImage}"/>
But how to use in code behind,thanks.

Hard to decipher error when input folder is missing on BuildDict

When invoking from command line using BuildDict, without the inputdir folder present, the result is:

Error Handling Commandline:
[TargetInvocationException] Exception has been thrown by the target of an invocation.
  [DirectoryNotFoundException] Could not find a part of the path 'H:\Table\SvgToXaml\svg\images.html'.

----Stacktrace----
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

Instead of a simple "input folder is missing".
I think stacktraces should also be hidden if not in some debug mode.

Unit test fails

Nice work! Just for your information, I ran the unit tests, and one of them failed:


  Expected string length 11757 but was 11229. Strings differ at index 814.
  Expected: "...phRun>\r\n            <GlyphRun BaselineOrigin="1.1717333,37..."
  But was:  "...phRun>\r\n            <GlyphRun PixelsPerDip="1.25" Baseline..."
  ----------------------------------------------^

   at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
   at SvgConverterTest.ConverterTests.SvgDirToXamlTest_withNamePrefix() in C:\dev\3rdParty\SvgToXaml\SvgConverterTest\ConverterTests.cs:line 96

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <DrawingGroup x:Key="NamePrefix_HandwheelDrawingGroup" ClipGeometry="M0,0 V40 H40 V0 H0 Z">
    <DrawingGroup>
      <GeometryDrawing>
        <GeometryDrawing.Pen>
          <Pen Brush="#FF0000FF" Thickness="1" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="1,0,0,1,-428.70961,-386.49945" Figures="M40,40z M0,0z M0,400L0,400" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <DrawingGroup>
        <GlyphRunDrawing ForegroundBrush="#FF000000">
          <GlyphRunDrawing.GlyphRun>
            <GlyphRun PixelsPerDip="1.25" BaselineOrigin="1.1717333,37.4375" FontRenderingEmSize="5.84810781" BidiLevel="0" IsSideways="False" ClusterMap="0 1 2 3 4 5 6 7 8" Characters="HANDWHEEL" GlyphIndices="43 36 49 39 58 43 40 40 47" AdvanceWidths="4.15113333333333 3.7711 4.37330666666667 3.95819333333333 5.46078666666667 4.15113333333333 2.95841333333333 2.95841333333333 2.75378" GlyphOffsets="0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0" Language="en-us">
              <GlyphRun.GlyphTypeface>
                <GlyphTypeface FontUri="C:\WINDOWS\FONTS\SEGOEUI.TTF" StyleSimulations="None" />
              </GlyphRun.GlyphTypeface>
            </GlyphRun>
          </GlyphRunDrawing.GlyphRun>
        </GlyphRunDrawing>
      </DrawingGroup>
      <GeometryDrawing>
        <GeometryDrawing.Brush>
          <SolidColorBrush Color="#FF000000" Opacity="0" Transform="0.9247968,0,0,0.9247968,31.152312,-1.2132876" />
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Brush="#FF000000" Thickness="1.29758234" StartLineCap="Square" EndLineCap="Square" LineJoin="Miter" />
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.9247968,0,0,0.9247968,31.152312,-1.2132876" Figures="M40,40z M0,0z M3.6875,19.1875A15.375,15.375,0,1,1,-27.0625,19.1875A15.375,15.375,0,1,1,3.6875,19.1875z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing>
        <GeometryDrawing.Brush>
          <SolidColorBrush Color="#FF000000" Opacity="0" Transform="0.7378049,0,0,0.7378049,28.966844,2.3746195" />
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Brush="#FF000000" Thickness="1.08429749" StartLineCap="Square" EndLineCap="Square" LineJoin="Miter" />
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.7378049,0,0,0.7378049,28.966844,2.3746195" Figures="M40,40z M0,0z M3.6875,19.1875A15.375,15.375,0,1,1,-27.0625,19.1875A15.375,15.375,0,1,1,3.6875,19.1875z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <DrawingGroup>
        <GlyphRunDrawing ForegroundBrush="#FF000000">
          <GlyphRunDrawing.GlyphRun>
            <GlyphRun PixelsPerDip="1.25" BaselineOrigin="10.376838,18.028101" FontRenderingEmSize="3.5710113" BidiLevel="0" IsSideways="False" ClusterMap="0 1 2 3 4 5 6 7 8" Characters="SINUMERIK" GlyphIndices="54 44 49 56 48 40 53 44 46" AdvanceWidths="1.89567 0.94962 2.67036 2.45259 3.20586 1.80642 2.13843 0.94962 2.0706" GlyphOffsets="0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0" Language="en-us">
              <GlyphRun.GlyphTypeface>
                <GlyphTypeface FontUri="C:\WINDOWS\FONTS\SEGOEUI.TTF" StyleSimulations="None" />
              </GlyphRun.GlyphTypeface>
            </GlyphRun>
          </GlyphRunDrawing.GlyphRun>
        </GlyphRunDrawing>
      </DrawingGroup>
      <GeometryDrawing>
        <GeometryDrawing.Brush>
          <SolidColorBrush Color="#FF000000" Opacity="1" Transform="0.6478873,0,0,0.6478873,28.817782,11.056338" />
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Brush="#FF000000" Thickness="1.23478258" StartLineCap="Square" EndLineCap="Square" LineJoin="Miter" />
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.6478873,0,0,0.6478873,28.817782,11.056338" Figures="M40,40z M0,0z M-10.8125,22.96875A2.21875,2.21875,0,1,1,-15.25,22.96875A2.21875,2.21875,0,1,1,-10.8125,22.96875z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
    </DrawingGroup>
  </DrawingGroup>
  <DrawingImage x:Key="NamePrefix_HandwheelDrawingImage" Drawing="{StaticResource NamePrefix_HandwheelDrawingGroup}" />
  <Geometry x:Key="NamePrefix_cloud_3_iconGeometry">F1 M512,512z M0,0z M409.338,216.254C398.922,161.293 350.672,120.477 293.557,120.477 258.459,120.477 225.926,135.762 203.686,162.061 166.538,152.155 127.607,173.842 116.753,210.84 78.16,222.176 50.6,257.895 50.6,299.303 50.6,350.155 91.97,391.524 143.822,391.524L369.18,391.524C420.03,391.524 461.401,350.155 461.401,299.303 461.4,263.389 440.941,231.457 409.338,216.254z M369.18,351.523L143.821,351.523C114.026,351.523 90.599,328.097 90.599,299.302 90.599,265.224 118.249,239.224 152.785,245.486 141.249,205.89 196.916,183.556 217.426,213.138 222.583,198.556 243.249,160.476 293.557,160.476 331.584,160.476 370.918,186.556 372.221,245.458 397.584,245.556 421.401,263.89 421.401,299.302 421.4,328.098 397.975,351.523 369.18,351.523z</Geometry>
  <DrawingGroup x:Key="NamePrefix_cloud_3_iconDrawingGroup" ClipGeometry="M0,0 V512 H512 V0 H0 Z">
    <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource NamePrefix_cloud_3_iconGeometry}" />
  </DrawingGroup>
  <DrawingImage x:Key="NamePrefix_cloud_3_iconDrawingImage" Drawing="{StaticResource NamePrefix_cloud_3_iconDrawingGroup}" />
  <Geometry x:Key="NamePrefix_JOGGeometry1">F1 M40,40z M0,0z M8.2386138,8.581114L10.997315,3.2949802 14.58093,13.0230932 18.243394,3.2861363 22.441828,13.0330022 26.104293,3.2772448 29.945413,13.0324862 31.821309,8.4079545</Geometry>
  <Geometry x:Key="NamePrefix_JOGGeometry2">F1 M40,40z M0,0z M7.8908055,20.894289L8.0965549,20.393659 8.3023024,19.912776 8.5080509,19.456537 8.7137985,19.02932 8.9195479,18.635628 9.1252954,18.279304 9.3310439,17.963927 9.5367934,17.692676 9.7425409,17.468068 9.9482894,17.292623 10.1540379,17.16793 10.3597866,17.095181 10.5655336,17.075303 10.7712836,17.1083 10.9770316,17.194034 11.1827796,17.331449 11.3885286,17.519217 11.5942766,17.755619 11.8000246,18.038133 12.0057726,18.363978 12.2115216,18.729844 12.4172706,19.132281 12.6230176,19.567052 12.8287676,20.029782 13.0345146,20.516099 13.2402636,21.020836 13.4460106,21.539223 13.6517606,22.065956 13.8575096,22.595737 14.0632576,23.123399 14.2690056,23.643506 14.4747536,24.151025 14.6805026,24.640655 14.8862506,25.107759 15.0919986,25.547565 15.2977486,25.9557 15.5034956,26.327926 15.7092446,26.660796 15.9149916,26.95073 16.1207416,27.195082 16.3264886,27.391199 16.5322376,27.537226 16.7379866,27.631708 16.9437346,27.673582 17.1494826,27.662584 17.3552316,27.598713 17.5609796,27.482631 17.7667276,27.315668 17.9724766,27.099143 18.1782256,26.835577 18.3839726,26.527356 18.5897216,26.177657 18.7954696,25.790062 19.0012176,25.368277 19.2069656,24.916545 19.4127146,24.439503 19.6184636,23.94179 19.8242106,23.42844 20.0299606,22.904489 20.2357076,22.375371 20.4414566,21.846252 20.6472036,21.322301 20.8529536,20.808951 21.0587016,20.311237 21.2644506,19.834196 21.4701986,19.382463 21.6759466,18.960679 21.8816956,18.573082 22.0874436,18.223385 22.2931916,17.915162 22.4989416,17.651596 22.7046886,17.435073 22.9104376,17.268108 23.1161846,17.152028 23.3219346,17.088158 23.5276816,17.07716 23.7334306,17.119033 23.9391796,17.213514 24.1449276,17.359541 24.3506756,17.555658 24.5564236,17.80001 24.7621726,18.089945 24.9679206,18.422814 25.1736696,18.79504 25.3794186,19.203174 25.5851656,19.642981 25.7909156,20.110084 25.9966626,20.599715 26.2024116,21.107233 26.4081586,21.627342 26.6139086,22.155002 26.8196566,22.684785 27.0254046,23.211519 27.2311536,23.729903 27.4369016,24.23464 27.6426496,24.720958 27.8483976,25.183688 28.0541466,25.618458 28.2598956,26.020897 28.4656436,26.386761 28.6713926,26.712607 28.8771396,26.995122 29.0828896,27.231522 29.2886366,27.419291 29.4943856,27.556706 29.7001346,27.642441 29.9058826,27.675436 30.1116306,27.65556 30.3173786,27.582811 30.5231276,27.458118 30.7288756,27.282672 30.9346236,27.058065 31.1403736,26.786814 31.3461206,26.471436 31.5518696,26.115112 31.7576166,25.72142 31.9633666,25.294203 32.1691136,24.837966</Geometry>
  <DrawingGroup x:Key="NamePrefix_JOGDrawingGroup" ClipGeometry="M0,0 V40 H40 V0 H0 Z">
    <DrawingGroup>
      <GeometryDrawing Geometry="{StaticResource NamePrefix_JOGGeometry1}">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF000000" Thickness="1.5" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <DrawingGroup Transform="0.9935628,0,0,1.0064789,0,0">
        <GlyphRunDrawing ForegroundBrush="#FF000000">
          <GlyphRunDrawing.GlyphRun>
            <GlyphRun PixelsPerDip="1.25" BaselineOrigin="11.428195,37.931644" FontRenderingEmSize="10.52512455" BidiLevel="0" IsSideways="False" ClusterMap="0 1 2" Characters="JOG" GlyphIndices="45 50 42" AdvanceWidths="5.85282666666667 8.18974666666667 8.18974666666667" GlyphOffsets="0,0 0,0 0,0" Language="en-us">
              <GlyphRun.GlyphTypeface>
                <GlyphTypeface FontUri="C:\WINDOWS\FONTS\ARIALBD.TTF" StyleSimulations="None" />
              </GlyphRun.GlyphTypeface>
            </GlyphRun>
          </GlyphRunDrawing.GlyphRun>
        </GlyphRunDrawing>
      </DrawingGroup>
      <GeometryDrawing>
        <GeometryDrawing.Pen>
          <Pen Brush="#FF0000FF" Thickness="1" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="1,0,0,1,-428.70961,-386.49945" Figures="M40,40z M0,0z M0,400L0,400" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing Geometry="{StaticResource NamePrefix_JOGGeometry2}">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF000000" Thickness="1.5" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
    </DrawingGroup>
  </DrawingGroup>
  <DrawingImage x:Key="NamePrefix_JOGDrawingImage" Drawing="{StaticResource NamePrefix_JOGDrawingGroup}" />
  <Geometry x:Key="NamePrefix_3d_view_iconGeometry">F1 M512,512z M0,0z M436.631,207.445L436.631,371.126 279.232,462 279.232,298.319 436.631,207.445z M256,258.08L436.201,154.04 256,50 75.799,154.041 256,258.08z M232.768,298.319L75.369,207.445 75.369,371.126 232.768,462 232.768,298.319z</Geometry>
  <DrawingGroup x:Key="NamePrefix_3d_view_iconDrawingGroup" ClipGeometry="M0,0 V512 H512 V0 H0 Z">
    <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource NamePrefix_3d_view_iconGeometry}" />
  </DrawingGroup>
  <DrawingImage x:Key="NamePrefix_3d_view_iconDrawingImage" Drawing="{StaticResource NamePrefix_3d_view_iconDrawingGroup}" />
</ResourceDictionary>

18 Errors in solution

1x Cannot find the static member 'JOGGeometry1Key' on the type 'Icons'.
\SvgToXaml-master\WpfDemoApp\Images\Icons.xaml
+
17x The name "Icons" does not exist in the namespace "clr-namespace:WpfDemoApp.Images".
WpfDemoApp ...\SvgToXaml-master\WpfDemoApp\Images\Icons.xaml

viewBox not considered if stroke is in path

If there is a "viewBox" in svg file, the SvgToXaml converter does not consider the relative coordinates of e.g. a "path", if there is a "stroke" defined in that "path". This is only done if there is a no "stroke" defined inside the "path" object in svg file.
What happens is:
In first case the convertrer produces e.g.:

    <GeometryDrawing Brush="#FFE68686" Geometry="{StaticResource testGeometry1}">
        <GeometryDrawing.Pen>
            <Pen Brush="#FFE6E6E6" Thickness="2" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
    </GeometryDrawing>

In second case the convertre produces e.g.:

    <GeometryDrawing Brush="#FFE6E6E6" Geometry="{StaticResource testGeometry2}" />

The problem could be solved, if for the svg "viewBox" e.g.: viewBox="0 0 120 120"
an additional line of e.g.:

    <GeometryDrawing Brush="Black" Geometry="F1 M120,120z M0,0z" />

would be added by the converter.

Whole numbers written as fractions

Hello,
I have noticed that sometimes drawings (icons) I make in Inkscape, when converted, have numbers like "15.999999" or so. Although not in itself bad, this leads to unexpected behaviour when using DrawingImages as icons in WPF, where they are drawn incorrectly, or e.g. when used in a menu, the normal selection background color will not show up as expected.
I fixed this in 2016 (mennowo@97af57f) and updated the fix now. I'll do a PR, so you can decide wether or not to integrate this.
See the attached file, that will have many 15.999999 values when converted using the current version.
SortByType.zip
Greets, Menno

OT: Request for feedback

Hello All,
I have made changes to the SharpVectors library to support ResourceDictionary, and I believe these changes can simplify and improve this tool. If you are interested, please test and provide feedbacks - thank you.

ElinamLLC/SharpVectors#224

Prebuilt binaries?

Hi,

Are there also prebuilt binaries, so i don't have to download the whole project?

Text is not always recognized in SVG

First: Thank you very much for this nice helpful tool.

I have som svg files where i have the problem that the result xaml path does not contain the text existing in the original.
I tried to investigate the original files to find a difference in the text description but everything looks okay for me.

In my explorer the extension renders everything and also in FireFox.

Excel_Export
RIB_Import_DataFromTXT
test.xaml.txt

Are hyperlinks active in XAML?

I have an application that generates SVG files on demand with hyperlinks to a custom protocol inside them. I'd rather display them natively in my than launching MSIE (apparently on MSIE supports launching custom protocols from an SVG) Are the hyperlinks in the converted SVG active?

Cannot build solution

I downloaded the .zip and opened the solution in VS 2019. The solution explorer tells me that SvgToXaml was unloaded. If I build the solution I get two errors:

  1. 'GlyphRun' does not contain a definition for 'PixelsPerDip' (ConverterLogic.cs line 508)
  2. Metadata file ...\SvgToXaml-master\SvgConverter\bin\Debug\SvgConverter.dll' could not be found

Support for UWP

Hey,

First, I would like to say that your tool is very helpful and useful, I have been using a lot this year.
I was wondering if you have something similar that can be directly implemented into UWP, that would be amazing.

Regards,
Majid Abu Rmila

Add option to upload svg through raw text / change color of the svg

Hi,

I would like an option to convert raw svg text to a .xaml file. For example

<svg width="99" height="81" viewBox="0 0 99 81" fill="none" xmlns="http://www.w3.org/2000/svg">
...
</svg>

Also an option to change the path color of the svgs that are uploaded to a certain color.

Anyway,

Great work!

Add option to convert to Canvas instead

I have some issues converting some SVG files as I cannot resize them properly. For example download this one https://www.svgrepo.com/svg/350341/gamepad and try to make it 32x32 in your application. Changing height/width of the image won't actuall fill/resize the underlaying DrawingImage to be in this size. Instead its either extremely tiny somewhere in right corner in the image or way too large. It's never properly filled.

The site https://materialdesignicons.com/ gives us the option to use DrawingImage or Canvas. With their XAML I have zero issues on scaling the SVG up/down.

Mixed usage of comma (,) and dot (.)

Generated Xaml:
<DrawingGroup ClipGeometry="M0,0 H779,52753 V667,20471 H0 V0 Z">
but should be:
<DrawingGroup ClipGeometry="M0,0 H779.52753 V667.20471 H0 V0 Z">

The CultureInfo should be always en-US.
So the following lines are missing in the App.xaml.cs:
System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false);
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);

Show neon effect

Now there are some neon SVG, Gaussian blur can not be converted into code to display.
Monster
image

MatrixTransform and 2 more Issues

Hello,

I am having several issues with a xaml created by your wonderful application.
I am running a fresh WPF application that I inserted the created xaml file into and merged the resourcedictionary into the standard window resources.

I have MatrixTransform elements that complain about having direct content.
1,0,0,1,0,63.500003
"The type "MatrixTransform" does not support direct content."

Somehow it cannot find something from sharpvectors?
<svg:EmbeddedBitmapSource Data="......"/>
"The name "EmbeddedBitmapSource" does not exist in the namespace "https://sharpvectors.codeplex.com/runtime/"."

The GlyphRunt has no such thing called "PixelsPerDip".
<GlyphRun PixelsPerDip="1"....../>
"The member PixeslPerDip" is not recognized or is not accessible."

SvgConverter/ConverterLogic.GetClipElement is using global XPath expr instead of local

ConverterLogic.cs:614:

        var clipElement = drawingGroupElement.XPathSelectElement("//defns:DrawingGroup.ClipGeometry", _nsManager);

This should start with "." otherwise it's searching for ClipGeometry in the entire document not relative to the current DrawingGroup.

        var clipElement = drawingGroupElement.XPathSelectElement(".//defns:DrawingGroup.ClipGeometry", _nsManager);

PixelsPerDip not found

Hello, to run the project i had to uncoment the following line, not sure what the implications are though:

        private static void FilterPixelsPerDip(XElement drawingElement)
        {
            var glyphRuns = drawingElement.Descendants(NsDef + nameof(GlyphRun)).ToList();
            foreach (var glyphRun in glyphRuns)
            {
                XAttribute pixelsPerDipAttr = null; // glyphRun.Attribute(nameof(GlyphRun.PixelsPerDip));
                if (pixelsPerDipAttr != null)
                    pixelsPerDipAttr.Remove();
            }
        }

1>D:\Projects\Hmi.Ushape\Tools\Tdc.FlagScraper\SvgToXaml\SvgConverter\ConverterLogic.cs(520,82,520,94): error CS0117: 'GlyphRun' does not contain a definition for 'PixelsPerDip'

I am running on netFx4.6.1 rather than netFx4.6.2. The project seems to build and run fine after my uncomment however.

Changing color is not working fine in demo app

Hello,

I tried to use the functionality , changing of color icons dynamically , implemented in wpfdemoapp. In that app, I tried to place my svg icon xaml and when I am clicking the change color button, in the svg icon, only one part is getting colored yellow, all other are black.

Can you please help me out in this.
This is the svg icon xaml file content.

<Geometry x:Key="cell_site_assignmentGeometry1">F1 M14.9,15.81z M0,0z M10.42,5.05L11.42,6.57C13.1,5.51 13.91,4.34 13.84,3.09 13.72,1.19 11.58,0.0900000000000003 11.33,4.44089209850063E-16L10.56,1.62C11,1.85 12,2.54 12,3.2 12,3.86 11.47,4.39 10.42,5.05z</Geometry>
<Geometry x:Key="cell_site_assignmentGeometry2">F1 M14.9,15.81z M0,0z M3.38,5.05C2.38,4.39 1.77,3.73 1.8,3.2 1.83,2.67 2.8,1.85 3.29,1.62L2.51,0C2.26,0.12 0.12,1.19 0,3.09 -0.07,4.34 0.74,5.51 2.42,6.57z</Geometry>
<Geometry x:Key="cell_site_assignmentGeometry3">F1 M14.9,15.81z M0,0z M8.11,12.86L8.45,12.66A4,4,0,0,1,8.45,11.97L8.11,11.77A0.46,0.46,0,0,1,7.93,11.22L8.18,10.63A0.44,0.44,0,0,1,8.69,10.37L9.07,10.47A3.17,3.17,0,0,1,9.56,10C9.56,9.87,9.49,9.74,9.46,9.61L9.46,9.61A0.46,0.46,0,0,1,9.58,9.19L7.79,5.59A2,2,0,0,0,8.9,3.81A2,2,0,0,0,4.9,3.81A2,2,0,0,0,6,5.59L0.9,15.81 5.9,13.81 7.9,13.81 8.14,13.91 7.93,13.4A0.44,0.44,0,0,1,8.11,12.86z</Geometry>
<Geometry x:Key="cell_site_assignmentGeometry4">F1 M14.9,15.81z M0,0z M14.72,13.28L14.43,13.11A2.91,2.91,0,0,0,14.43,12.52L14.72,12.35A0.38,0.38,0,0,0,14.87,11.88L14.87,11.88 14.66,11.37A0.38,0.38,0,0,0,14.22,11.15L13.89,11.23A2.65,2.65,0,0,0,13.48,10.82C13.48,10.71,13.54,10.6,13.56,10.49A0.37,0.37,0,0,0,13.34,10.05L12.84,9.84A0.38,0.38,0,0,0,12.37,10L12.19,10.29A1.88,1.88,0,0,0,11.61,10.29L11.43,10A0.38,0.38,0,0,0,11,9.84L10.5,10.05A0.37,0.37,0,0,0,10.28,10.49C10.28,10.6,10.28,10.71,10.36,10.82A2.65,2.65,0,0,0,9.95,11.23L9.62,11.15A0.38,0.38,0,0,0,9.18,11.37L8.97,11.88A0.38,0.38,0,0,0,9.12,12.35L9.41,12.52A2.91,2.91,0,0,0,9.41,13.11L9.12,13.28A0.38,0.38,0,0,0,8.97,13.75L9.18,14.25A0.37,0.37,0,0,0,9.62,14.47L9.95,14.39A3.25,3.25,0,0,0,10.36,14.81C10.36,14.92,10.3,15.03,10.28,15.13A0.39,0.39,0,0,0,10.5,15.58L11,15.78A0.4,0.4,0,0,0,11.15,15.78A0.36,0.36,0,0,0,11.47,15.6L11.65,15.31A2.91,2.91,0,0,0,12.24,15.31C12.29,15.41,12.35,15.5,12.41,15.6A0.36,0.36,0,0,0,12.88,15.75L13.38,15.55A0.39,0.39,0,0,0,13.6,15.1C13.6,15,13.55,14.89,13.52,14.78A2.33,2.33,0,0,0,13.93,14.36L14.26,14.44A0.37,0.37,0,0,0,14.7,14.22L14.91,13.72A0.38,0.38,0,0,0,14.72,13.28z M14.3,14.08L14,14A0.37,0.37,0,0,0,13.61,14.14A2.59,2.59,0,0,1,13.24,14.51A0.37,0.37,0,0,0,13.1,14.91C13.1,15.01,13.16,15.12,13.18,15.22L12.72,15.41C12.72,15.32,12.61,15.23,12.56,15.13A0.41,0.41,0,0,0,12.18,14.94A1.51,1.51,0,0,1,11.66,14.94A0.41,0.41,0,0,0,11.28,15.13C11.28,15.23,11.17,15.32,11.12,15.41L10.66,15.22C10.66,15.12,10.66,15.01,10.74,14.91A0.38,0.38,0,0,0,10.61,14.51A2.22,2.22,0,0,1,10.23,14.14A0.37,0.37,0,0,0,9.82,14L9.5,14.09 9.31,13.62 9.59,13.46A0.39,0.39,0,0,0,9.78,13.08A2.26,2.26,0,0,1,9.78,12.56A0.39,0.39,0,0,0,9.59,12.18L9.31,12 9.5,11.54 9.82,11.62A0.37,0.37,0,0,0,10.21,11.49A1.9,1.9,0,0,1,10.59,11.12A0.38,0.38,0,0,0,10.72,10.72C10.72,10.61,10.66,10.51,10.64,10.41L11.1,10.21 11.26,10.49A0.38,0.38,0,0,0,11.64,10.68A2.26,2.26,0,0,1,12.16,10.68A0.38,0.38,0,0,0,12.54,10.49C12.59,10.4,12.65,10.31,12.7,10.21L13.16,10.41C13.16,10.51,13.11,10.61,13.08,10.72A0.37,0.37,0,0,0,13.22,11.12A2.16,2.16,0,0,1,13.59,11.49A0.37,0.37,0,0,0,13.98,11.62L14.3,11.54 14.49,12 14.21,12.16A0.39,0.39,0,0,0,14.02,12.54A2.26,2.26,0,0,1,14.02,13.06A0.39,0.39,0,0,0,14.21,13.44L14.49,13.6z</Geometry>
<Geometry x:Key="cell_site_assignmentGeometry5">F1 M14.9,15.81z M0,0z M13.18,12.28L13.18,12.28A1.39,1.39,0,0,0,10.62,13.34A1.41,1.41,0,0,0,11.37,14.09A1.39,1.39,0,0,0,13.18,12.28z M12.27,13.71A1,1,0,0,1,11.53,13.71A1,1,0,0,1,11,13.19A1,1,0,0,1,11.53,11.91A0.94,0.94,0,0,1,11.9,11.84A1,1,0,0,1,12.27,13.71z</Geometry>
<DrawingGroup x:Key="cell_site_assignmentDrawingGroup" ClipGeometry="M0,0 V15.81 H14.9 V0 H0 Z">
    <DrawingGroup.Transform>
        <TranslateTransform X="0.00417676568031311" Y="0" />
    </DrawingGroup.Transform>
    <DrawingGroup Opacity="1">
        <DrawingGroup Opacity="1">
            <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource cell_site_assignmentGeometry1}" />
            <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource cell_site_assignmentGeometry2}" />
            <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource cell_site_assignmentGeometry3}" />
            <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource cell_site_assignmentGeometry4}" />
            <GeometryDrawing Brush="#FF000000" Geometry="{StaticResource cell_site_assignmentGeometry5}" />
        </DrawingGroup>
    </DrawingGroup>
</DrawingGroup>
<DrawingImage x:Key="cell_site_assignmentDrawingImage" Drawing="{StaticResource cell_site_assignmentDrawingGroup}" />

clip geometry error

In SvgConverter/ConverterLogic.cs:

//add Attribute: ClipGeometry="M0,0 V40 H40 V0 H0 Z" this is the description of a rectangle-like Geometry
                clipElement.Parent.Add(new XAttribute("ClipGeometry", string.Format(CultureInfo.InvariantCulture, "M{0},{1} V{2} H{3} V{0} H{1} Z", clipRect.Left, clipRect.Top, clipRect.Bottom, clipRect.Right)));

It should be M{0},{1} V{2} H{3} V{1} H{0} rather than V{0} H{1} since {1} is top and {0} is left

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.