- From: Kevin Lindsey <kevin@kevlindev.com>
- Date: Fri, 11 Jun 2004 15:56:29 -0500
- To: <www-svg@w3.org>
Jonathan, > > The SVGMatrix attributes are mutable > > So what does the "raises DOMException on setting" comment for these > attributes mean? Yes, I find this confusing too. You can interpret that to mean that SVGMatrix *might* throw exception if you use a bad value, like NaN, for instance. This makes more sense if you've coded in Java. Java allows you to specify that a method (including getters and setters) throws certain exceptions. This doesn't mean that it will throw the exception, but it could, so you have to write code to handle that exception in case it does occur. > So the SVGMatrix stored by an SVGTransform should be its own private > copy? I.e. the SVGMatrix object passed into setMatrix() and returned by > the attribute matrix, are not the same SVGMatrix object as the one > stored by the SVGTransform object? That is my understanding. I don't have it handy otherwise I check, but you may want to look at what Batik is doing. Chances are they are using the correct interpretation since some of the developers are on the working group. > Obviously the answer to that question makes quite a difference to the > outcome of the following script. > > var matrix1 = getANewSVGMatrix(); > var transform = getANewSVGTransform(); > transform.setMatrix(matrix1); > var matrix2 = transform.matrix; > matrix1.a += 2; > matrix2.b += 2; > > If SVGTransform objects don't keep their own private SVGMatrix object > then the changes to matrix1 and matrix2 would affect each other and > transform. Right. This may be a good example of why the matrix attribute is defined the way it is. Since SVGMatrix maintains its own private copy, matrix1 and matrix2 would be independent of one another. Kevin
Received on Friday, 11 June 2004 16:57:12 UTC