2012-06-11 5 views
1

SVG에서이 example (SVG로 그려지지 않음)과 같이 겹치는 모양의 부분을 채우려면 어떻게해야합니까? 도형에서 채우기 패턴을 생략하면 다른 모양에서 제거 된 패턴이 겹치기를 원합니다. 그 후에 더 많은 모양이 다시 겹쳐져 패턴을 다시 그릴 수 있습니다. 코드에서이 SVG를 생성하고 각 모양에 대해 코드에서 채우기 패턴을 더하거나 뺄 것인지를 알 수 있습니다.SVG : 겹쳐진 모양으로 패턴 채우기

여기 내 SVG가 있습니다. 도형을 그리고 채우기 패턴을 정의하지만 사용하지는 않습니다.

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="640" height="480" viewBox="0 0 640 480"> 
<defs> 
    <marker id="endArrowGreen" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" orient="auto" markerWidth="5" markerHeight="4"> 
    <polyline points="0,0 10,5 0,10 1,5" fill="#00CC00" stroke="#00CC00"/> 
    </marker> 
    <marker id="startArrowGreen" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" orient="auto" markerWidth="5" markerHeight="4"> 
    <polyline points="10,0 0,5 10,10 9,5" fill="#00CC00" stroke="#00CC00"/> 
    </marker> 
    <marker id="endArrowBlue" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" orient="auto" markerWidth="5" markerHeight="4"> 
    <polyline points="0,0 10,5 0,10 1,5" fill="#0000CC" stroke="#0000CC"/> 
    </marker> 
    <marker id="startArrowBlue" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" orient="auto" markerWidth="5" markerHeight="4"> 
    <polyline points="10,0 0,5 10,10 9,5" fill="#0000CC" stroke="#0000CC"/> 
    </marker> 
    <pattern id="Crosshatch" patternUnits="userSpaceOnUse" 
       x="0" y="0" width="10" height="10" 
       viewBox="0 0 10 10" > 
     <path d="M 0 10 L 10 0" stroke-width="1" stroke="blue" /> 
    </pattern> 
    </defs> 
<g> 
<line x1="7.78888" y1="6.08366" x2="319.087" y2="6.08366" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(319.087 6.08366) rotate(0)"/> 
<line x1="319.087" y1="6.08366" x2="630.385" y2="6.08366" stroke-width="1" stroke="#0000CC" /> 
<line x1="630.385" y1="6.08366" x2="630.385" y2="469.354" stroke-width="1" stroke="#0000CC" /> 
<line x1="630.385" y1="469.354" x2="7.78888" y2="469.354" stroke-width="1" stroke="#0000CC" /> 
<line x1="7.78888" y1="469.354" x2="7.78888" y2="237.719" stroke-width="1" stroke="#0000CC" /> 
<line x1="7.78888" y1="6.08366" x2="7.78888" y2="237.719" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(7.78888 237.719) rotate(90)"/> 
</g> 
<circle cx="298.914" cy="237.087" r="218.732" stroke-width="1" stroke="#0000CC" fill="none"/> 
<circle cx="262.395" cy="238.913" r="100" stroke-width="1" stroke="#0000CC" fill="none"/> 
<circle cx="438.601" cy="236.175" r="129.523" stroke-width="1" stroke="#0000CC" fill="none"/> 
<g> 
<line x1="99.913" y1="248.646" x2="302.566" y2="248.646" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(302.566 248.646) rotate(0)"/> 
<line x1="302.566" y1="248.646" x2="505.22" y2="248.646" stroke-width="1" stroke="#0000CC" /> 
<line x1="505.22" y1="248.646" x2="505.22" y2="291.232" stroke-width="1" stroke="#0000CC" /> 
<line x1="505.22" y1="291.232" x2="99.913" y2="291.232" stroke-width="1" stroke="#0000CC" /> 
<line x1="99.913" y1="291.232" x2="99.913" y2="269.939" stroke-width="1" stroke="#0000CC" /> 
<line x1="99.913" y1="248.646" x2="99.913" y2="269.939" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(99.913 269.939) rotate(90)"/> 
</g> 
<g> 
<line x1="114.521" y1="181.118" x2="303.023" y2="181.118" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(303.023 181.118) rotate(0)"/> 
<line x1="303.023" y1="181.118" x2="491.525" y2="181.118" stroke-width="1" stroke="#0000CC" /> 
<line x1="491.525" y1="181.118" x2="491.525" y2="212.753" stroke-width="1" stroke="#0000CC" /> 
<line x1="491.525" y1="212.753" x2="114.521" y2="212.753" stroke-width="1" stroke="#0000CC" /> 
<line x1="114.521" y1="212.753" x2="114.521" y2="196.935" stroke-width="1" stroke="#0000CC" /> 
<line x1="114.521" y1="181.118" x2="114.521" y2="196.935" stroke-width="1" stroke="#0000CC" /> 
<polyline points="0,0 -6,-3 -5,0 -6,3" fill="#0000CC" stroke="#0000CC" transform="translate(114.521 196.935) rotate(90)"/> 
</g> 
</svg> 

답변

관련 문제