simpletransform.py revision 519331d368aba3d43cf2c121b14be130ed54ef35
'''
Copyright (C) 2006 Jean-Francois Barraud, barraud@math.univ-lille1.fr
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
barraud@math.univ-lille1.fr
This code defines several functions to make handling of transform
attribute easier.
'''
return(mat)
#-- translate --
dy=0.0
else:
#-- scale --
else:
#-- rotate --
else:
#-- skewX --
#-- skewX --
#-- matrix --
else:
return matrix
def formatTransform(mat):
pt[0]=x
pt[1]=y
def fuseTransform(node):
#FIX ME: how do you raise errors?
raise AssertionError, 'can not fuse "transform" of elements that have no "d" attribute'
if t == None:
return
m = parseTransform(t)
p = cubicsuperpath.parsePath(d)
applyTransformToPath(m,p)
####################################################################
##-- Some functions to compute a rough bbox of a given list of objects.
##-- this should be shipped out in an separate file...
if b1 is None:
return b2
elif b2 is None:
return b1
else:
bbox=None
m = composeTransform(mat,m)
#TODO: text not supported!
p = cubicsuperpath.parsePath(d)
applyTransformToPath(m,p)
return bbox