• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

AffineTransformQt.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00014  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00017  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00018  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00019  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00020  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00021  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00023  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00024  */
00025 
00026 #include "config.h"
00027 #include "wtf/Platform.h"
00028 #include "AffineTransform.h"
00029 
00030 #include "IntRect.h"
00031 #include "FloatRect.h"
00032 
00033 namespace WebCore {
00034 
00035 AffineTransform::AffineTransform()
00036     : m_transform()
00037 {
00038 }
00039 
00040 AffineTransform::AffineTransform(double a, double b, double c, double d, double tx, double ty)
00041     : m_transform(a, b, c, d, tx, ty)
00042 {
00043 }
00044 
00045 AffineTransform::AffineTransform(const QMatrix& matrix)
00046     : m_transform(matrix)
00047 {
00048 }
00049 
00050 void AffineTransform::setMatrix(double a, double b, double c, double d, double tx, double ty)
00051 {
00052     m_transform.setMatrix(a, b, c, d, tx, ty);
00053 }
00054 
00055 void AffineTransform::map(double x, double y, double* x2, double* y2) const
00056 {
00057     qreal tx2, ty2;
00058     m_transform.map(qreal(x), qreal(y), &tx2, &ty2);
00059     *x2 = tx2;
00060     *y2 = ty2;
00061 }
00062 
00063 IntRect AffineTransform::mapRect(const IntRect& rect) const
00064 {
00065     return m_transform.mapRect(rect);
00066 }
00067 
00068 FloatRect AffineTransform::mapRect(const FloatRect& rect) const
00069 {
00070     return m_transform.mapRect(rect);
00071 }
00072 
00073 bool AffineTransform::isIdentity() const
00074 {
00075     return m_transform.isIdentity();
00076 }
00077 
00078 double AffineTransform::a() const
00079 {
00080     return m_transform.m11();
00081 }
00082 
00083 void AffineTransform::setA(double a)
00084 {
00085     m_transform.setMatrix(a, b(), c(), d(), e(), f());
00086 }
00087 
00088 double AffineTransform::b() const
00089 {
00090     return m_transform.m12();
00091 }
00092 
00093 void AffineTransform::setB(double b)
00094 {
00095     m_transform.setMatrix(a(), b, c(), d(), e(), f());
00096 }
00097 
00098 double AffineTransform::c() const
00099 {
00100     return m_transform.m21();
00101 }
00102 
00103 void AffineTransform::setC(double c)
00104 {
00105     m_transform.setMatrix(a(), b(), c, d(), e(), f());
00106 }
00107 
00108 double AffineTransform::d() const
00109 {
00110     return m_transform.m22();
00111 }
00112 
00113 void AffineTransform::setD(double d)
00114 {
00115     m_transform.setMatrix(a(), b(), c(), d, e(), f());
00116 }
00117 
00118 double AffineTransform::e() const
00119 {
00120     return m_transform.dx();
00121 }
00122 
00123 void AffineTransform::setE(double e)
00124 {
00125     m_transform.setMatrix(a(), b(), c(), d(), e, f());
00126 }
00127 
00128 double AffineTransform::f() const
00129 {
00130     return m_transform.dy();
00131 }
00132 
00133 void AffineTransform::setF(double f)
00134 {
00135     m_transform.setMatrix(a(), b(), c(), d(), e(), f);
00136 }
00137 
00138 void AffineTransform::reset()
00139 {
00140     m_transform.reset();
00141 }
00142 
00143 AffineTransform& AffineTransform::scale(double sx, double sy)
00144 {
00145     m_transform.scale(sx, sy);
00146     return *this;
00147 }
00148 
00149 AffineTransform& AffineTransform::rotate(double d)
00150 {
00151     m_transform.rotate(d);
00152     return *this;
00153 }
00154 
00155 AffineTransform& AffineTransform::translate(double tx, double ty)
00156 {
00157     m_transform.translate(tx, ty);
00158     return *this;
00159 }
00160 
00161 AffineTransform& AffineTransform::shear(double sx, double sy)
00162 {
00163     m_transform.shear(sx, sy);
00164     return *this;
00165 }
00166 
00167 double AffineTransform::det() const
00168 {
00169     return m_transform.det();
00170 }
00171 
00172 AffineTransform AffineTransform::inverse() const
00173 {
00174     if(!isInvertible())
00175         return AffineTransform();
00176 
00177     return m_transform.inverted();
00178 }
00179 
00180 AffineTransform::operator QMatrix() const
00181 {
00182     return m_transform;
00183 }
00184 
00185 bool AffineTransform::operator==(const AffineTransform& other) const
00186 {
00187     return m_transform == other.m_transform;
00188 }
00189 
00190 AffineTransform& AffineTransform::operator*=(const AffineTransform& other)
00191 {
00192     m_transform *= other.m_transform;
00193     return *this;
00194 }
00195 
00196 AffineTransform AffineTransform::operator*(const AffineTransform& other)
00197 {
00198     return m_transform * other.m_transform;
00199 }
00200 
00201 }
00202 
00203 // vim: ts=4 sw=4 et

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal