| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> | 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> |
| 3 2004, 2005 Rob Buis <buis@kde.org> | 3 2004, 2005 Rob Buis <buis@kde.org> |
| 4 | 4 |
| 5 This file is part of the KDE project | 5 This file is part of the KDE project |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
| 8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
| 9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
| 10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 m_angle = 0; | 89 m_angle = 0; |
| 90 | 90 |
| 91 m_matrix = matrix; | 91 m_matrix = matrix; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void SVGTransform::setTranslate(float tx, float ty) | 94 void SVGTransform::setTranslate(float tx, float ty) |
| 95 { | 95 { |
| 96 m_type = SVG_TRANSFORM_TRANSLATE; | 96 m_type = SVG_TRANSFORM_TRANSLATE; |
| 97 m_angle = 0; | 97 m_angle = 0; |
| 98 | 98 |
| 99 m_matrix.reset(); | 99 m_matrix.makeIdentity(); |
| 100 m_matrix.translate(tx, ty); | 100 m_matrix.translate(tx, ty); |
| 101 } | 101 } |
| 102 | 102 |
| 103 FloatPoint SVGTransform::translate() const | 103 FloatPoint SVGTransform::translate() const |
| 104 { | 104 { |
| 105 return FloatPoint::narrowPrecision(m_matrix.e(), m_matrix.f()); | 105 return FloatPoint::narrowPrecision(m_matrix.e(), m_matrix.f()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SVGTransform::setScale(float sx, float sy) | 108 void SVGTransform::setScale(float sx, float sy) |
| 109 { | 109 { |
| 110 m_type = SVG_TRANSFORM_SCALE; | 110 m_type = SVG_TRANSFORM_SCALE; |
| 111 m_angle = 0; | 111 m_angle = 0; |
| 112 m_center = FloatPoint(); | 112 m_center = FloatPoint(); |
| 113 | 113 |
| 114 m_matrix.reset(); | 114 m_matrix.makeIdentity(); |
| 115 m_matrix.scale(sx, sy); | 115 m_matrix.scaleNonUniform(sx, sy); |
| 116 } | 116 } |
| 117 | 117 |
| 118 FloatSize SVGTransform::scale() const | 118 FloatSize SVGTransform::scale() const |
| 119 { | 119 { |
| 120 return FloatSize::narrowPrecision(m_matrix.a(), m_matrix.d()); | 120 return FloatSize::narrowPrecision(m_matrix.a(), m_matrix.d()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void SVGTransform::setRotate(float angle, float cx, float cy) | 123 void SVGTransform::setRotate(float angle, float cx, float cy) |
| 124 { | 124 { |
| 125 m_type = SVG_TRANSFORM_ROTATE; | 125 m_type = SVG_TRANSFORM_ROTATE; |
| 126 m_angle = angle; | 126 m_angle = angle; |
| 127 m_center = FloatPoint(cx, cy); | 127 m_center = FloatPoint(cx, cy); |
| 128 | 128 |
| 129 // TODO: toString() implementation, which can show cx, cy (need to be stored
?) | 129 // TODO: toString() implementation, which can show cx, cy (need to be stored
?) |
| 130 m_matrix.reset(); | 130 m_matrix.makeIdentity(); |
| 131 m_matrix.translate(cx, cy); | 131 m_matrix.translate(cx, cy); |
| 132 m_matrix.rotate(angle); | 132 m_matrix.rotate(angle); |
| 133 m_matrix.translate(-cx, -cy); | 133 m_matrix.translate(-cx, -cy); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void SVGTransform::setSkewX(float angle) | 136 void SVGTransform::setSkewX(float angle) |
| 137 { | 137 { |
| 138 m_type = SVG_TRANSFORM_SKEWX; | 138 m_type = SVG_TRANSFORM_SKEWX; |
| 139 m_angle = angle; | 139 m_angle = angle; |
| 140 | 140 |
| 141 m_matrix.reset(); | 141 m_matrix.makeIdentity(); |
| 142 m_matrix.skewX(angle); | 142 m_matrix.skewX(angle); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void SVGTransform::setSkewY(float angle) | 145 void SVGTransform::setSkewY(float angle) |
| 146 { | 146 { |
| 147 m_type = SVG_TRANSFORM_SKEWY; | 147 m_type = SVG_TRANSFORM_SKEWY; |
| 148 m_angle = angle; | 148 m_angle = angle; |
| 149 | 149 |
| 150 m_matrix.reset(); | 150 m_matrix.makeIdentity(); |
| 151 m_matrix.skewY(angle); | 151 m_matrix.skewY(angle); |
| 152 } | 152 } |
| 153 | 153 |
| 154 // vim:ts=4:noet | 154 // vim:ts=4:noet |
| 155 #endif // ENABLE(SVG) | 155 #endif // ENABLE(SVG) |
| 156 | 156 |
| OLD | NEW |