Re: SVGTransform and SVGMatrix

Thanks for your reply Kevin.

Kevin Lindsey wrote:

 > Jonathan,
 >
 >> I'm looking for some clarification on:
 >>
 >> a) whether SVGMatrix is intended to be immutable
 >
 > The SVGMatrix attributes are mutable


So what does the "raises DOMException on setting" comment for these 
attributes mean?

 >> b) why there is a setMatrix function for SVGTransform when its matrix
 >>    attribute is readonly
 >>
 >> What is the intention of the specification?
 >
 > FWIW, I look at it this way. SVGTransform has a matrix attribute of type
 > SVGMatrix. That attribute cannot be altered, which means that you cannot
 > assign an SVGMatrix to the matrix attribute. However, an SVGMatrix is a
 > compound type with attributes that are mutable. So, you can alter the
 > attributes of the matrix attribute. setMatrix is a convenience 
function so
 > you don't have to write out 6 individual assignments to set the 
attributes
 > of the matrix attribute.
 >
 > Kevin


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?

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.

Regards,

Jonathan

Received on Friday, 11 June 2004 16:48:50 UTC