private String parse ( Matrix matrix ) { String transform = "" ; if ( matrix != null ) { double dx = matrix . getDx ( ) ; double dy = matrix . getDy ( ) ; if ( matrix . getXx ( ) != 0 && matrix . getYy ( ) != 0 && matrix . getXx ( ) != 1 && matrix . getYy ( ) != 1 ) { transform += "scale(" + matrix . getXx ( ) + ", " + matrix . getYy ( ) + ")" ; // scale first // no space between 'scale' and '(' !!! dx /= matrix . getXx ( ) ; dy /= matrix . getYy ( ) ; } transform += " translate(" + ( float ) dx + ", " + ( float ) dy + ")" ; // no space between 'translate' and '(' !!! } return transform ; }
Parse a matrix object into a string suitable for the SVG transform attribute .