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

KHTML

  • khtml
  • platform
  • graphics
AffineTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
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 #ifndef AffineTransform_h
27 #define AffineTransform_h
28 
29 #if PLATFORM(CG)
30 #include <CoreGraphics/CGAffineTransform.h>
31 #elif PLATFORM(QT)
32 #include <QMatrix>
33 #elif PLATFORM(CAIRO)
34 #include <cairo.h>
35 #elif PLATFORM(WX) && USE(WXGC)
36 #include <wx/defs.h>
37 #include <wx/graphics.h>
38 #endif
39 
40 namespace WebCore {
41 
42 class IntPoint;
43 class IntRect;
44 class FloatPoint;
45 class FloatRect;
46 
47 class AffineTransform {
48 public:
49  AffineTransform();
50  AffineTransform(double a, double b, double c, double d, double e, double f);
51 #if PLATFORM(CG)
52  AffineTransform(CGAffineTransform transform);
53 #elif PLATFORM(QT)
54  AffineTransform(const QMatrix &matrix);
55 #elif PLATFORM(CAIRO)
56  AffineTransform(const cairo_matrix_t &matrix);
57 #elif PLATFORM(WX) && USE(WXGC)
58  AffineTransform(const wxGraphicsMatrix &matrix);
59 #endif
60 
61  void setMatrix(double a, double b, double c, double d, double e, double f);
62  void map(double x, double y, double *x2, double *y2) const;
63  IntPoint mapPoint(const IntPoint&) const;
64  FloatPoint mapPoint(const FloatPoint&) const;
65  IntRect mapRect(const IntRect&) const;
66  FloatRect mapRect(const FloatRect&) const;
67 
68  bool isIdentity() const;
69 
70  double a() const;
71  void setA(double a);
72 
73  double b() const;
74  void setB(double b);
75 
76  double c() const;
77  void setC(double c);
78 
79  double d() const;
80  void setD(double d);
81 
82  double e() const;
83  void setE(double e);
84 
85  double f() const;
86  void setF(double f);
87 
88  void reset();
89 
90  AffineTransform& multiply(const AffineTransform&);
91  AffineTransform& scale(double);
92  AffineTransform& scale(double sx, double sy);
93  AffineTransform& scaleNonUniform(double sx, double sy);
94  AffineTransform& rotate(double d);
95  AffineTransform& rotateFromVector(double x, double y);
96  AffineTransform& translate(double tx, double ty);
97  AffineTransform& shear(double sx, double sy);
98  AffineTransform& flipX();
99  AffineTransform& flipY();
100  AffineTransform& skew(double angleX, double angleY);
101  AffineTransform& skewX(double angle);
102  AffineTransform& skewY(double angle);
103 
104  double det() const;
105  bool isInvertible() const;
106  AffineTransform inverse() const;
107 
108 #if PLATFORM(CG)
109  operator CGAffineTransform() const;
110 #elif PLATFORM(QT)
111  operator QMatrix() const;
112 #elif PLATFORM(CAIRO)
113  operator cairo_matrix_t() const;
114 #elif PLATFORM(WX) && USE(WXGC)
115  operator wxGraphicsMatrix() const;
116 #endif
117 
118  bool operator==(const AffineTransform&) const;
119  bool operator!=(const AffineTransform& other) const { return !(*this == other); }
120  AffineTransform& operator*=(const AffineTransform&);
121  AffineTransform operator*(const AffineTransform&);
122 
123 private:
124 #if PLATFORM(CG)
125  CGAffineTransform m_transform;
126 #elif PLATFORM(QT)
127  QMatrix m_transform;
128 #elif PLATFORM(CAIRO)
129  cairo_matrix_t m_transform;
130 #elif PLATFORM(WX) && USE(WXGC)
131  wxGraphicsMatrix m_transform;
132 #endif
133 };
134 
135 } // namespace WebCore
136 
137 #endif // AffineTransform_h
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jun 1 2013 20:22:25 by doxygen 1.8.3.1 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.10.4 API Reference

Skip menu "kdelibs-4.10.4 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