2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
24 #include "SVGTransformList.h"
26 #include "AffineTransform.h"
27 #include "SVGSVGElement.h"
28 #include "SVGTransform.h"
29 #include <wtf/text/StringBuilder.h>
33 SVGTransform SVGTransformList::createSVGTransformFromMatrix(const SVGMatrix& matrix) const
35 return SVGSVGElement::createSVGTransformFromMatrix(matrix);
38 SVGTransform SVGTransformList::consolidate()
40 AffineTransform matrix;
41 if (!concatenate(matrix))
42 return SVGTransform();
44 SVGTransform transform(matrix);
50 bool SVGTransformList::concatenate(AffineTransform& result) const
52 unsigned size = this->size();
56 for (unsigned i = 0; i < size; ++i)
57 result *= at(i).matrix();
62 String SVGTransformList::valueAsString() const
64 StringBuilder builder;
65 unsigned size = this->size();
66 for (unsigned i = 0; i < size; ++i) {
70 builder.append(at(i).valueAsString());
73 return builder.toString();
76 } // namespace WebCore