Using SVG path definitions as clip mask in ImagickDraw
Posted: 2015-03-18T09:45:49-07:00
Hello, new to IM, so apologies if this question has already been answered (although I did not find it after searching).
I have been given a series of .svg files, each containing an outline which we need to use as a clipping mask. I am wondering if there is some way to use the path definition ("d" attribute in the svg tag) as an argument to some method in ImagickDraw to draw the path.
For example, here is an .svg file that I'm working with:
I'd like to be able to take the "d" attribute, and draw it into a clipping mask (I don't care about the stroke color or any other information besides the path). Open to other suggestions as well, if I'm approaching this all wrong. Thanks in advance for any help you could provide.
I have been given a series of .svg files, each containing an outline which we need to use as a clipping mask. I am wondering if there is some way to use the path definition ("d" attribute in the svg tag) as an argument to some method in ImagickDraw to draw the path.
For example, here is an .svg file that I'm working with:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="792px" height="612px" viewBox="0 0 792 612" enable-background="new 0 0 792 612" xml:space="preserve">
<path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#009FE3" stroke-miterlimit="10" d="M338.196,350.536
c0-3.727,3.018-6.744,6.743-6.744h94.513c3.726,0,6.744,3.018,6.744,6.744v35.111c0,3.727-3.019,6.744-6.744,6.744h-94.513
c-3.726,0-6.743-3.018-6.743-6.744V350.536z"/>
</svg>