Inkscapers,
Should inkscape refuse to load a file that includes an <image element which references the svg file itself?
I don't see anything in the svg spec about how you're supposed to exit their (accidentally enabled?) recursion and inkscape 0.43 runs to 1.3GB of ram very quickly (I'm not brave enough today to see if it goes all the way to the OS barrier, but I don't see any signs that it wouldn't.)
I would attach the file, but I don't want to get accused of sending virii :-) If you have the ram and stomach for it, just slap this into the middle of a skeleton file named image_recursive.svg and enjoy.
<image y="103.00504" x="48.357143" id="image1355" height="355.85715" width="345.17828" xlink:href="image_recursive.svg" />
--Eric
Eric Wilhelm wrote:
Inkscapers,
Should inkscape refuse to load a file that includes an <image element which references the svg file itself?
I don't see anything in the svg spec about how you're supposed to exit their (accidentally enabled?) recursion and inkscape 0.43 runs to 1.3GB of ram very quickly (I'm not brave enough today to see if it goes all the way to the OS barrier, but I don't see any signs that it wouldn't.)
I would attach the file, but I don't want to get accused of sending virii :-) If you have the ram and stomach for it, just slap this into the middle of a skeleton file named image_recursive.svg and enjoy.
<image y="103.00504" x="48.357143" id="image1355" height="355.85715" width="345.17828" xlink:href="image_recursive.svg" />
--Eric
Apparently, an svg image can reference images, including svg and even itself. It is allowed here: http://www.w3.org/TR/SVG11/coords.html#EstablishingANewViewport
So I think that maybe to avoid recursion you should catch an occurrence of an SVG ref-ing itself without either a non-identity transform or a viewbox.
I think that an Escher-like image of a man holding a picture of a man holding a picture of a man, etc... would be valid. Tough to render, but valid.
bob
# from Bob Jamison # on Friday 20 January 2006 07:45 pm:
Apparently, an svg image can reference images, including svg and even itself. It is allowed here: http://www.w3.org/TR/SVG11/coords.html#EstablishingANewViewport
Except:
http://www.w3.org/TR/SVG11/struct.html#Head
"URI references that directly or indirectly reference themselves are treated as invalid circular references."
So, even in the case of file1.svg -> file2.svg -> file1.svg, the reference (when first seen) in file1.svg is invalid. Of course, you won't know that until you find that file2 refs file1 but my reading of the above "or indirectly" implies that file1.svg contains the "invalid circular reference."
I think that an Escher-like image of a man holding a picture of a man holding a picture of a man, etc... would be valid. Tough to render, but valid.
No, because there is no indication of where to stop (that fine line between circularity and recursion.) Unfortunately, this means that you cannot (in a recursive space-efficient way) include a finite number of successively smaller pictures of pictures. Rather, the best you could do would be to def the picture and then iteratively list N "use" copies of it on top of each other (explicitly scaling each one to the reduced size.) Without a finite limit, the render will never happen because it has to wait until the innermost element is rendered onto the next innermost element, and so on.
--Eric
Eric Wilhelm wrote:
# from Bob Jamison # on Friday 20 January 2006 07:45 pm:
I think that an Escher-like image of a man holding a picture of a man holding a picture of a man, etc... would be valid. Tough to render, but valid.
No, because there is no indication of where to stop (that fine line between circularity and recursion.) Unfortunately, this means that you cannot (in a recursive space-efficient way) include a finite number of successively smaller pictures of pictures. Rather, the best you could do would be to def the picture and then iteratively list N "use" copies of it on top of each other (explicitly scaling each one to the reduced size.) Without a finite limit, the render will never happen because it has to wait until the innermost element is rendered onto the next innermost element, and so on.
Yes, you are right about this. I should have made the distinction that a reference to itself would need to be made with a 'use'.
However, this would still allow recursion. You could make a viewport of any piece of the whole image, and put a viewbox of the piece anywhere on it.
Somewhere in the W3C docs, I think (Not the main one. I don't remember which) they have an example of a tree with self-referential pieces hanging from it.
bob
participants (2)
-
Bob Jamison
-
Eric Wilhelm