• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • platform
  • graphics
  • qt
AffineTransformQt.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "wtf/Platform.h"
28#include "AffineTransform.h"
29
30#include "IntRect.h"
31#include "FloatRect.h"
32
33namespace WebCore {
34
35AffineTransform::AffineTransform()
36 : m_transform()
37{
38}
39
40AffineTransform::AffineTransform(double a, double b, double c, double d, double tx, double ty)
41 : m_transform(a, b, c, d, tx, ty)
42{
43}
44
45AffineTransform::AffineTransform(const QMatrix& matrix)
46 : m_transform(matrix)
47{
48}
49
50void AffineTransform::setMatrix(double a, double b, double c, double d, double tx, double ty)
51{
52 m_transform.setMatrix(a, b, c, d, tx, ty);
53}
54
55void AffineTransform::map(double x, double y, double* x2, double* y2) const
56{
57 qreal tx2, ty2;
58 m_transform.map(qreal(x), qreal(y), &tx2, &ty2);
59 *x2 = tx2;
60 *y2 = ty2;
61}
62
63IntRect AffineTransform::mapRect(const IntRect& rect) const
64{
65 return m_transform.mapRect(rect);
66}
67
68FloatRect AffineTransform::mapRect(const FloatRect& rect) const
69{
70 return m_transform.mapRect(rect);
71}
72
73bool AffineTransform::isIdentity() const
74{
75 return m_transform.isIdentity();
76}
77
78double AffineTransform::a() const
79{
80 return m_transform.m11();
81}
82
83void AffineTransform::setA(double a)
84{
85 m_transform.setMatrix(a, b(), c(), d(), e(), f());
86}
87
88double AffineTransform::b() const
89{
90 return m_transform.m12();
91}
92
93void AffineTransform::setB(double b)
94{
95 m_transform.setMatrix(a(), b, c(), d(), e(), f());
96}
97
98double AffineTransform::c() const
99{
100 return m_transform.m21();
101}
102
103void AffineTransform::setC(double c)
104{
105 m_transform.setMatrix(a(), b(), c, d(), e(), f());
106}
107
108double AffineTransform::d() const
109{
110 return m_transform.m22();
111}
112
113void AffineTransform::setD(double d)
114{
115 m_transform.setMatrix(a(), b(), c(), d, e(), f());
116}
117
118double AffineTransform::e() const
119{
120 return m_transform.dx();
121}
122
123void AffineTransform::setE(double e)
124{
125 m_transform.setMatrix(a(), b(), c(), d(), e, f());
126}
127
128double AffineTransform::f() const
129{
130 return m_transform.dy();
131}
132
133void AffineTransform::setF(double f)
134{
135 m_transform.setMatrix(a(), b(), c(), d(), e(), f);
136}
137
138void AffineTransform::reset()
139{
140 m_transform.reset();
141}
142
143AffineTransform& AffineTransform::scale(double sx, double sy)
144{
145 m_transform.scale(sx, sy);
146 return *this;
147}
148
149AffineTransform& AffineTransform::rotate(double d)
150{
151 m_transform.rotate(d);
152 return *this;
153}
154
155AffineTransform& AffineTransform::translate(double tx, double ty)
156{
157 m_transform.translate(tx, ty);
158 return *this;
159}
160
161AffineTransform& AffineTransform::shear(double sx, double sy)
162{
163 m_transform.shear(sx, sy);
164 return *this;
165}
166
167double AffineTransform::det() const
168{
169 return m_transform.det();
170}
171
172AffineTransform AffineTransform::inverse() const
173{
174 if(!isInvertible())
175 return AffineTransform();
176
177 return m_transform.inverted();
178}
179
180AffineTransform::operator QMatrix() const
181{
182 return m_transform;
183}
184
185bool AffineTransform::operator==(const AffineTransform& other) const
186{
187 return m_transform == other.m_transform;
188}
189
190AffineTransform& AffineTransform::operator*=(const AffineTransform& other)
191{
192 m_transform *= other.m_transform;
193 return *this;
194}
195
196AffineTransform AffineTransform::operator*(const AffineTransform& other)
197{
198 return m_transform * other.m_transform;
199}
200
201}
202
203// vim: ts=4 sw=4 et
AffineTransform.h
FloatRect.h
IntRect.h
WebCore::AffineTransform
Definition: AffineTransform.h:47
WebCore::AffineTransform::inverse
AffineTransform inverse() const
Definition: AffineTransformQt.cpp:172
WebCore::AffineTransform::operator*
AffineTransform operator*(const AffineTransform &)
Definition: AffineTransformQt.cpp:196
WebCore::AffineTransform::b
double b() const
Definition: AffineTransformQt.cpp:88
WebCore::AffineTransform::isInvertible
bool isInvertible() const
Definition: AffineTransform.cpp:37
WebCore::AffineTransform::rotate
AffineTransform & rotate(double d)
Definition: AffineTransformQt.cpp:149
WebCore::AffineTransform::shear
AffineTransform & shear(double sx, double sy)
Definition: AffineTransformQt.cpp:161
WebCore::AffineTransform::d
double d() const
Definition: AffineTransformQt.cpp:108
WebCore::AffineTransform::translate
AffineTransform & translate(double tx, double ty)
Definition: AffineTransformQt.cpp:155
WebCore::AffineTransform::e
double e() const
Definition: AffineTransformQt.cpp:118
WebCore::AffineTransform::setA
void setA(double a)
Definition: AffineTransformQt.cpp:83
WebCore::AffineTransform::setB
void setB(double b)
Definition: AffineTransformQt.cpp:93
WebCore::AffineTransform::a
double a() const
Definition: AffineTransformQt.cpp:78
WebCore::AffineTransform::det
double det() const
Definition: AffineTransformQt.cpp:167
WebCore::AffineTransform::f
double f() const
Definition: AffineTransformQt.cpp:128
WebCore::AffineTransform::operator*=
AffineTransform & operator*=(const AffineTransform &)
Definition: AffineTransformQt.cpp:190
WebCore::AffineTransform::setF
void setF(double f)
Definition: AffineTransformQt.cpp:133
WebCore::AffineTransform::setMatrix
void setMatrix(double a, double b, double c, double d, double e, double f)
Definition: AffineTransformQt.cpp:50
WebCore::AffineTransform::setC
void setC(double c)
Definition: AffineTransformQt.cpp:103
WebCore::AffineTransform::isIdentity
bool isIdentity() const
Definition: AffineTransformQt.cpp:73
WebCore::AffineTransform::map
void map(double x, double y, double *x2, double *y2) const
Definition: AffineTransformQt.cpp:55
WebCore::AffineTransform::setE
void setE(double e)
Definition: AffineTransformQt.cpp:123
WebCore::AffineTransform::mapRect
IntRect mapRect(const IntRect &) const
Definition: AffineTransformQt.cpp:63
WebCore::AffineTransform::scale
AffineTransform & scale(double)
Definition: AffineTransform.cpp:47
WebCore::AffineTransform::AffineTransform
AffineTransform()
Definition: AffineTransformQt.cpp:35
WebCore::AffineTransform::reset
void reset()
Definition: AffineTransformQt.cpp:138
WebCore::AffineTransform::c
double c() const
Definition: AffineTransformQt.cpp:98
WebCore::AffineTransform::operator==
bool operator==(const AffineTransform &) const
Definition: AffineTransformQt.cpp:185
WebCore::AffineTransform::setD
void setD(double d)
Definition: AffineTransformQt.cpp:113
WebCore::FloatRect
Definition: FloatRect.h:59
WebCore::IntRect
Definition: IntRect.h:65
d
#define d
Definition: khtmlfind.cpp:42
WebCore
Definition: CSSHelper.h:7
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal