TransWikia.com

Fill inside a tikz path

TeX - LaTeX Asked on July 28, 2021

I have a tikz path generated by svg2tikz. I would like to fill inside this path, but tikz just fills a portion of the curve.

documentclass{standalone}
usepackage{tikz}

begin{document}

    begin{tikzpicture}[y=0.80pt, x=0.80pt, scale = 0.5, xscale=-1]

    path[draw=black,fill=red,line join=round,line cap=round,miter limit=10.00,line
    width=1.152pt] (236.1551,372.7024) -- (164.5751,372.1624)(164.5751,372.1624)
    -- (136.8551,371.0224)(-265.0249,319.1824) --
    (-252.4249,319.1824)(358.6151,243.0424) --
    (370.3751,284.6824)(358.6151,243.0424) --
    (358.6151,224.8624)(236.1551,372.7024) --
    (242.9951,372.7024)(242.9951,372.7024) -- (243.5351,372.7024) .. controls
    (256.3591,372.9774) and (264.5721,370.5524) .. (275.4551,363.7024) --
    (276.0551,363.3424) -- (276.5951,362.9824) .. controls (286.7211,356.6404) and
    (298.3241,345.8414) .. (310.6751,345.2224) --
    (311.8151,345.2224)(375.8951,336.8224) --
    (375.8951,332.0224)(-252.4249,338.4424) --
    (69.7151,366.5824)(-270.5449,219.3424) --
    (-270.5449,287.4424)(-248.5249,213.1624) --
    (-264.3649,213.1624)(-226.5049,207.6424) --
    (-248.5249,213.1624)(-226.5049,207.6424) -- (-226.2649,207.0424) --
    (-225.9049,206.4424) -- (-225.4849,205.9024) --
    (-225.0649,205.4224)(-225.0649,205.4224) -- (-224.2849,204.7624) .. controls
    (-222.5349,203.3134) and (-220.2839,202.5944) .. (-218.0449,202.4824) --
    (-217.5649,202.4824)(-209.9449,202.4824) --
    (-217.5649,202.4824)(-42.1849,224.8624) --
    (358.6151,224.8624)(-154.9849,206.0224) -- (-196.9849,203.0224) --
    (-209.9449,202.4824)(375.8951,332.0224) --
    (370.3751,284.6824)(69.7151,366.6424) --
    (136.8551,371.0224)(-154.9849,206.0224) --
    (-42.1849,224.8624)(-265.0249,319.1824) --
    (-270.5449,313.6624)(-252.4249,338.4424) --
    (-252.4249,319.1824)(-270.5449,313.6624) --
    (-270.5449,287.4424)(-264.3649,213.1624) -- (-264.9049,213.1624) .. controls
    (-267.8639,213.4214) and (-270.2949,215.8474) .. (-270.4849,218.8024) --
    (-270.5449,219.3424)(311.8151,345.2224) --
    (311.8151,338.3224)(311.8151,338.3224) --
    (318.6551,338.3224)(318.6551,338.3224) --
    (318.6551,345.2224)(318.6551,345.2224) --
    (367.4951,345.2224)(367.4951,345.2224) -- (368.2751,345.1624) .. controls
    (372.2011,344.8734) and (375.6141,341.4814) .. (375.8351,337.5424) --
    (375.8951,336.8224);

    end{tikzpicture}

end{document}

One Answer

While you try to find how to instruct svg2tikz to build a unique path, with a little bit of patience you can do it by hand.

documentclass[border=2mm]{standalone}
usepackage{tikz}

begin{document}

    begin{tikzpicture}[y=0.80pt, x=0.80pt, scale = 0.5, xscale=-1]

    path[draw=black,fill=red,line join=round,line cap=round,miter limit=10.00,line
    width=1.152pt] (236.1551,372.7024) -- 
    (164.5751,372.1624) -- (136.8551,371.0224) -- (69.7151,366.6424) -- (-252.4249,338.4424) -- (-252.4249,319.1824)
-- (-265.0249,319.1824) -- (-270.5449,313.6624) -- (-270.5449,287.4424) -- (-270.5449,219.3424) -- (-270.4849,218.8024) .. controls
    (-270.2949,215.8474) and (-267.8639,213.4214) .. (-264.9049,213.1624) -- (-264.3649,213.1624) -- (-248.5249,213.1624) -- (-226.5049,207.6424) -- (-226.2649,207.0424) -- (-225.9049,206.4424) -- (-225.4849,205.9024) -- (-225.0649,205.4224) -- (-224.2849,204.7624) .. controls
    (-220.2839,202.5944) and (-222.5349,203.3134) .. (-218.0449,202.4824) --
    (-217.5649,202.4824) -- (-209.9449,202.4824) -- (-196.9849,203.0224) --
    (-154.9849,206.0224) -- (-42.1849,224.8624) -- (358.6151,224.8624) --(358.6151,243.0424) -- (370.3751,284.6824) -- (375.8951,332.0224) -- (375.8951,336.8224)
    -- (375.8351,337.5424) .. controls (375.6141,341.4814)
     and (372.2011,344.8734) .. (368.2751,345.1624) --(367.4951,345.2224) -- (318.6551,345.2224) -- (318.6551,338.3224) -- (311.8151,338.3224) -- (311.8151,345.2224)
    -- (310.6751,345.2224) .. controls (298.3241,345.8414) and (286.7211,356.6404) ..
(276.5951,362.9824) -- (276.0551,363.3424) -- (275.4551,363.7024) .. controls
    (264.5721,370.5524) and (256.3591,372.9774) .. (243.5351,372.7024) -- (242.9951,372.7024) -- (236.1551,372.7024) 
    ;
    end{tikzpicture}

end{document}

enter image description here

Correct answer by Ignasi on July 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP