diff options
Diffstat (limited to 'basegfx/inc/basegfx/tuple/b2ituple.hxx')
-rw-r--r-- | basegfx/inc/basegfx/tuple/b2ituple.hxx | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/basegfx/inc/basegfx/tuple/b2ituple.hxx b/basegfx/inc/basegfx/tuple/b2ituple.hxx index 636862f365b8..2611d386e7d6 100644 --- a/basegfx/inc/basegfx/tuple/b2ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b2ituple.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,57 +45,57 @@ namespace basegfx class B2ITuple { protected: - sal_Int32 mnX; - sal_Int32 mnY; - - public: - /** Create a 2D Tuple + sal_Int32 mnX; + sal_Int32 mnY; + + public: + /** Create a 2D Tuple The tuple is initialized to (0, 0) */ - B2ITuple() - : mnX(0), - mnY(0) + B2ITuple() + : mnX(0), + mnY(0) {} - /** Create a 2D Tuple + /** Create a 2D Tuple @param fX This parameter is used to initialize the X-coordinate of the 2D Tuple. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Tuple. */ - B2ITuple(sal_Int32 fX, sal_Int32 fY) - : mnX( fX ), - mnY( fY ) + B2ITuple(sal_Int32 fX, sal_Int32 fY) + : mnX( fX ), + mnY( fY ) {} - /** Create a copy of a 2D Tuple + /** Create a copy of a 2D Tuple @param rTup The 2D Tuple which will be copied. */ - B2ITuple(const B2ITuple& rTup) - : mnX( rTup.mnX ), - mnY( rTup.mnY ) + B2ITuple(const B2ITuple& rTup) + : mnX( rTup.mnX ), + mnY( rTup.mnY ) {} - ~B2ITuple() + ~B2ITuple() {} /// Get X-Coordinate of 2D Tuple sal_Int32 getX() const - { - return mnX; + { + return mnX; } /// Get Y-Coordinate of 2D Tuple sal_Int32 getY() const - { - return mnY; + { + return mnY; } /// Set X-Coordinate of 2D Tuple @@ -111,8 +111,8 @@ namespace basegfx } /// Array-access to 2D Tuple - const sal_Int32& operator[] (int nPos) const - { + const sal_Int32& operator[] (int nPos) const + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -121,7 +121,7 @@ namespace basegfx /// Array-access to 2D Tuple sal_Int32& operator[] (int nPos) - { + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -131,70 +131,70 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B2ITuple& operator+=( const B2ITuple& rTup ) - { + B2ITuple& operator+=( const B2ITuple& rTup ) + { mnX += rTup.mnX; - mnY += rTup.mnY; - return *this; + mnY += rTup.mnY; + return *this; } - B2ITuple& operator-=( const B2ITuple& rTup ) - { + B2ITuple& operator-=( const B2ITuple& rTup ) + { mnX -= rTup.mnX; - mnY -= rTup.mnY; - return *this; + mnY -= rTup.mnY; + return *this; } - B2ITuple& operator/=( const B2ITuple& rTup ) - { + B2ITuple& operator/=( const B2ITuple& rTup ) + { mnX /= rTup.mnX; - mnY /= rTup.mnY; - return *this; + mnY /= rTup.mnY; + return *this; } - B2ITuple& operator*=( const B2ITuple& rTup ) - { + B2ITuple& operator*=( const B2ITuple& rTup ) + { mnX *= rTup.mnX; - mnY *= rTup.mnY; - return *this; + mnY *= rTup.mnY; + return *this; } - B2ITuple& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - return *this; + B2ITuple& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + return *this; } - B2ITuple& operator/=(sal_Int32 t) - { - mnX /= t; - mnY /= t; - return *this; + B2ITuple& operator/=(sal_Int32 t) + { + mnX /= t; + mnY /= t; + return *this; } - B2ITuple operator-(void) const - { - return B2ITuple(-mnX, -mnY); + B2ITuple operator-(void) const + { + return B2ITuple(-mnX, -mnY); } - + bool equalZero() const { return mnX == 0 && mnY == 0; } - bool operator==( const B2ITuple& rTup ) const - { + bool operator==( const B2ITuple& rTup ) const + { return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } - bool operator!=( const B2ITuple& rTup ) const - { + bool operator!=( const B2ITuple& rTup ) const + { return !(*this == rTup); } - - B2ITuple& operator=( const B2ITuple& rTup ) - { + + B2ITuple& operator=( const B2ITuple& rTup ) + { mnX = rTup.mnX; - mnY = rTup.mnY; - return *this; + mnY = rTup.mnY; + return *this; } static const B2ITuple& getEmptyTuple(); @@ -205,16 +205,16 @@ namespace basegfx class B2DTuple; - B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); - - B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); + B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); - B2ITuple absolute(const B2ITuple& rTup); + B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); - B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); + B2ITuple absolute(const B2ITuple& rTup); - B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); + B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3); B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB); |