pleyo.com

/src/trunk2/BAL/Interfaces/graphics/BTAffineTransform.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
00003  * Copyright (C) 2007 Pleyo.  All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00015  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00018  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025  */
00026 
00027 #ifndef BTAffineTransform_h
00028 #define BTAffineTransform_h
00029 
00030 #if PLATFORM(CG)
00031 #include <ApplicationServices/ApplicationServices.h>
00032 #elif PLATFORM(QT)
00033 #include <QMatrix>
00034 #elif PLATFORM(CAIRO)
00035 #include "cairo.h"
00036 #endif
00037 
00038 namespace WebCore {
00039 
00040 class IntPoint;
00041 class IntRect;
00042 class FloatRect;
00043 
00044 #ifdef __OWB__
00045 }
00046 
00047 using WebCore::IntPoint;
00048 using WebCore::IntRect;
00049 using WebCore::FloatRect;
00050 namespace BAL {
00051 #endif
00052 
00053 class BTAffineTransform {
00054 public:
00055     BTAffineTransform();
00056     BTAffineTransform(double a, double b, double c, double d, double e, double f);
00057 #if PLATFORM(CG)
00058     BTAffineTransform(CGAffineTransform transform);
00059 #elif PLATFORM(QT)
00060     BTAffineTransform(const QMatrix &matrix);
00061 #elif PLATFORM(CAIRO)
00062     BTAffineTransform(const cairo_matrix_t &matrix);
00063 #endif
00064 
00065     void setMatrix(double a, double b, double c, double d, double e, double f);
00066     void map(double x, double y, double *x2, double *y2) const;
00067     IntPoint mapPoint(const IntPoint&) const;
00068     IntRect mapRect(const IntRect&) const;
00069     FloatRect mapRect(const FloatRect&) const;
00070 
00071     bool isIdentity() const;
00072 
00073     double a() const;
00074     void setA(double a);
00075 
00076     double b() const;
00077     void setB(double b);
00078 
00079     double c() const;
00080     void setC(double c);
00081 
00082     double d() const;
00083     void setD(double d);
00084 
00085     double e() const;
00086     void setE(double e);
00087 
00088     double f() const;
00089     void setF(double f);
00090 
00091     void reset();
00092 
00093     BTAffineTransform& multiply(const BTAffineTransform&);
00094     BTAffineTransform& scale(double);
00095     BTAffineTransform& scale(double sx, double sy);
00096     BTAffineTransform& scaleNonUniform(double sx, double sy);
00097     BTAffineTransform& rotate(double d);
00098     BTAffineTransform& rotateFromVector(double x, double y);
00099     BTAffineTransform& translate(double tx, double ty);
00100     BTAffineTransform& shear(double sx, double sy);
00101     BTAffineTransform& flipX();
00102     BTAffineTransform& flipY();
00103     BTAffineTransform& skew(double angleX, double angleY);
00104     BTAffineTransform& skewX(double angle);
00105     BTAffineTransform& skewY(double angle);
00106 
00107     double det() const;
00108     bool isInvertible() const;
00109     BTAffineTransform inverse() const;
00110 
00111 #if PLATFORM(CG)
00112     operator CGAffineTransform() const;
00113 #elif PLATFORM(QT)
00114     operator QMatrix() const;
00115 #elif PLATFORM(CAIRO)
00116     operator cairo_matrix_t() const;
00117 #endif
00118 
00119     bool operator==(const BTAffineTransform&) const;
00120     BTAffineTransform& operator*=(const BTAffineTransform&);
00121     BTAffineTransform operator*(const BTAffineTransform&);
00122 
00123 private:
00124 #if PLATFORM(CG)
00125     CGAffineTransform m_transform;
00126 #elif PLATFORM(QT)
00127     QMatrix m_transform;
00128 #elif PLATFORM(CAIRO)
00129     cairo_matrix_t m_transform;
00130 #elif defined __OWB__
00131     double m_m11;
00132     double m_m12;
00133     double m_m21;
00134     double m_m22;
00135     double m_dx;
00136     double m_dy;
00137 #endif
00138 };
00139 
00140 } // namespace WebCore
00141 
00142 #endif // BTAffineTransform_h

Generated on Wed Nov 21 20:04:17 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com