diff options
author | Thorsten Behrens <thb@openoffice.org> | 2004-02-25 08:54:11 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2004-02-25 08:54:11 +0000 |
commit | cd2ca2e0d127c6ac7a6baaefee6e2088c1df098f (patch) | |
tree | fc749563189aff1c4a33266f076690aab6f9b2b8 /basegfx | |
parent | ea8c622450a59641b2f7af9809182fc490f89672 (diff) |
#110496# Made B2ITuple convertible to B2DTuple. Completed filter list
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/inc/basegfx/tuple/b2dtuple.hxx | 18 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tuple/b2ituple.hxx | 116 | ||||
-rw-r--r-- | basegfx/source/tuple/b2ituple.cxx | 115 | ||||
-rw-r--r-- | basegfx/util/basegfx.flt | 2 |
4 files changed, 150 insertions, 101 deletions
diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index dc472d49bea4..af753177e5b9 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dtuple.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2004-02-16 17:03:08 $ + * last change: $Author: thb $ $Date: 2004-02-25 09:54:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,10 @@ #include <math.h> #endif +#ifndef _BGFX_TUPLE_B2ITUPLE_HXX +#include <basegfx/tuple/b2ituple.hxx> +#endif + namespace basegfx { /** Base class for all Points/Vectors with two double values @@ -124,6 +128,16 @@ namespace basegfx mfY( rTup.mfY ) {} + /** Create a copy of a 2D integer Tuple + + @param rTup + The 2D Tuple which will be copied. + */ + B2DTuple(const B2ITuple& rTup) + : mfX( rTup.getX() ), + mfY( rTup.getY() ) + {} + ~B2DTuple() {} diff --git a/basegfx/inc/basegfx/tuple/b2ituple.hxx b/basegfx/inc/basegfx/tuple/b2ituple.hxx index d68b9316cfe3..fbe78e1a8879 100644 --- a/basegfx/inc/basegfx/tuple/b2ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b2ituple.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2ituple.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2004-02-16 17:03:09 $ + * last change: $Author: thb $ $Date: 2004-02-25 09:54:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,10 +66,6 @@ #include <sal/types.h> #endif -#ifndef _BGFX_TUPLE_B2DTUPLE_HXX -#include <basegfx/tuple/b2dtuple.hxx> -#endif - namespace basegfx { @@ -248,110 +244,36 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aMin( - (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), - (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY()); - return aMin; - } + class B2DTuple; - inline B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aMax( - (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), - (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY()); - return aMax; - } + B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2ITuple absolute(const B2ITuple& rTup) - { - B2ITuple aAbs( - (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); - return aAbs; - } + B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t) - { - B2DTuple aInt( - ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), - ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); - return aInt; - } + B2ITuple absolute(const B2ITuple& rTup); - inline B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) - { - B2DTuple aAvg( - (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5); - return aAvg; - } + B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); - inline B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3) - { - B2DTuple aAvg( - (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); - return aAvg; - } + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); - inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aSum(rTupA); - aSum += rTupB; - return aSum; - } + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3); - inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aSub(rTupA); - aSub -= rTupB; - return aSub; - } + B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; - } + B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aMul(rTupA); - aMul *= rTupB; - return aMul; - } + B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew *= t; - return aNew; - } + B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB); - inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) - { - B2ITuple aNew(rTup); - aNew *= t; - return aNew; - } + B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t); - inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew /= t; - return aNew; - } + B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup); + + B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t); + + B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup); - inline B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) - { - B2ITuple aNew(t, t); - B2ITuple aTmp(rTup); - aNew /= aTmp; - return aNew; - } } // end of namespace basegfx #endif /* _BGFX_TUPLE_B2ITUPLE_HXX */ diff --git a/basegfx/source/tuple/b2ituple.cxx b/basegfx/source/tuple/b2ituple.cxx index 24bb4bc1d160..4211d66db6c6 100644 --- a/basegfx/source/tuple/b2ituple.cxx +++ b/basegfx/source/tuple/b2ituple.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2ituple.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2004-01-16 10:37:24 $ + * last change: $Author: thb $ $Date: 2004-02-25 09:54:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,12 +62,123 @@ #ifndef _BGFX_TUPLE_B2ITUPLE_HXX #include <basegfx/tuple/b2ituple.hxx> #endif +#ifndef _BGFX_TUPLE_B2DTUPLE_HXX +#include <basegfx/tuple/b2dtuple.hxx> +#endif namespace basegfx { // initialize static member ::basegfx::B2ITuple B2ITuple::maEmptyTuple(0, 0); + // external operators + ////////////////////////////////////////////////////////////////////////// + + B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aMin( + (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), + (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY()); + return aMin; + } + + B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aMax( + (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), + (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY()); + return aMax; + } + + B2ITuple absolute(const B2ITuple& rTup) + { + B2ITuple aAbs( + (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), + (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); + return aAbs; + } + + B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t) + { + B2DTuple aInt( + ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), + ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); + return aInt; + } + + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) + { + B2DTuple aAvg( + (rOld1.getX() + rOld2.getX()) * 0.5, + (rOld1.getY() + rOld2.getY()) * 0.5); + return aAvg; + } + + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3) + { + B2DTuple aAvg( + (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), + (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); + return aAvg; + } + + B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aSum(rTupA); + aSum += rTupB; + return aSum; + } + + B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aSub(rTupA); + aSub -= rTupB; + return aSub; + } + + B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; + } + + B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) + { + B2ITuple aMul(rTupA); + aMul *= rTupB; + return aMul; + } + + B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) + { + B2ITuple aNew(rTup); + aNew *= t; + return aNew; + } + + B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) + { + B2ITuple aNew(rTup); + aNew *= t; + return aNew; + } + + B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) + { + B2ITuple aNew(rTup); + aNew /= t; + return aNew; + } + + B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) + { + B2ITuple aNew(t, t); + B2ITuple aTmp(rTup); + aNew /= aTmp; + return aNew; + } + } // end of namespace basegfx // eof diff --git a/basegfx/util/basegfx.flt b/basegfx/util/basegfx.flt index f388a3c34057..28a1dd1b65c6 100644 --- a/basegfx/util/basegfx.flt +++ b/basegfx/util/basegfx.flt @@ -1,2 +1,4 @@ +__CT Impl IMP +internal
\ No newline at end of file |