LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/basegfx/matrix - b2dhommatrix.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 4 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
      30                 :            : #define _BGFX_MATRIX_B2DHOMMATRIX_HXX
      31                 :            : 
      32                 :            : #include <sal/types.h>
      33                 :            : #include <o3tl/cow_wrapper.hxx>
      34                 :            : #include <basegfx/basegfxdllapi.h>
      35                 :            : 
      36                 :            : namespace basegfx
      37                 :            : {
      38                 :            :     class B2DTuple;
      39                 :            :     class Impl2DHomMatrix;
      40                 :            : 
      41                 :            :     class BASEGFX_DLLPUBLIC B2DHomMatrix
      42                 :            :     {
      43                 :            :     public:
      44                 :            :         typedef o3tl::cow_wrapper< Impl2DHomMatrix > ImplType;
      45                 :            : 
      46                 :            :     private:
      47                 :            :         ImplType                                     mpImpl;
      48                 :            : 
      49                 :            :     public:
      50                 :            :         B2DHomMatrix();
      51                 :            :         B2DHomMatrix(const B2DHomMatrix& rMat);
      52                 :            :         ~B2DHomMatrix();
      53                 :            : 
      54                 :            :         /** constructor to allow setting all needed values for a 3x2 matrix at once. The
      55                 :            :             parameter f_0x1 e.g. is the same as using set(0, 1, f)
      56                 :            :          */
      57                 :            :         B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
      58                 :            : 
      59                 :            :         double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
      60                 :            :         void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
      61                 :            : 
      62                 :            :         /** allow setting all needed values for a 3x2 matrix in one call. The
      63                 :            :             parameter f_0x1 e.g. is the same as using set(0, 1, f)
      64                 :            :          */
      65                 :            :         void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
      66                 :            : 
      67                 :            :         // test if last line is default to see if last line needs to be
      68                 :            :         // involved in calculations
      69                 :            :         bool isLastLineDefault() const;
      70                 :            : 
      71                 :            :         // reset to a standard matrix
      72                 :            :         bool isIdentity() const;
      73                 :            :         void identity();
      74                 :            : 
      75                 :            :         bool isInvertible() const;
      76                 :            :         bool invert();
      77                 :            : 
      78                 :            :         void rotate(double fRadiant);
      79                 :            : 
      80                 :            :         void translate(double fX, double fY);
      81                 :            : 
      82                 :            :         void scale(double fX, double fY);
      83                 :            : 
      84                 :            :         // Shearing-Matrices
      85                 :            :         void shearX(double fSx);
      86                 :            :         void shearY(double fSy);
      87                 :            : 
      88                 :            :         B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
      89                 :            :         B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
      90                 :            : 
      91                 :            :         bool operator==(const B2DHomMatrix& rMat) const;
      92                 :            :         bool operator!=(const B2DHomMatrix& rMat) const;
      93                 :            : 
      94                 :            :         B2DHomMatrix& operator*=(double fValue);
      95                 :            :         B2DHomMatrix& operator/=(double fValue);
      96                 :            : 
      97                 :            :         // matrix multiplication from the left to the local
      98                 :            :         B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
      99                 :            : 
     100                 :            :         // assignment operator
     101                 :            :         B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
     102                 :            : 
     103                 :            :         // Help routine to decompose given homogen 3x3 matrix to components. A correction of
     104                 :            :         // the components is done to avoid inaccuracies.
     105                 :            :         bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
     106                 :            :     };
     107                 :            : 
     108                 :            :     // addition, subtraction
     109                 :            :     inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
     110                 :            :     {
     111                 :            :         B2DHomMatrix aSum(rMatA);
     112                 :            :         aSum += rMatB;
     113                 :            :         return aSum;
     114                 :            :     }
     115                 :            : 
     116                 :            :     inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
     117                 :            :     {
     118                 :            :         B2DHomMatrix aDiv(rMatA);
     119                 :            :         aDiv -= rMatB;
     120                 :            :         return aDiv;
     121                 :            :     }
     122                 :            : 
     123                 :            :     // multiplication, division by a constant
     124                 :            :     inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
     125                 :            :     {
     126                 :            :         B2DHomMatrix aNew(rMat);
     127                 :            :         aNew *= fValue;
     128                 :            :         return aNew;
     129                 :            :     }
     130                 :            : 
     131                 :            :     inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue)
     132                 :            :     {
     133                 :            :         B2DHomMatrix aNew(rMat);
     134                 :            :         aNew *= 1.0 / fValue;
     135                 :            :         return aNew;
     136                 :            :     }
     137                 :            : 
     138                 :     353774 :     inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
     139                 :            :     {
     140                 :     353774 :         B2DHomMatrix aMul(rMatB);
     141         [ +  - ]:     353774 :         aMul *= rMatA;
     142                 :     353774 :         return aMul;
     143                 :            :     }
     144                 :            : } // end of namespace basegfx
     145                 :            : 
     146                 :            : #endif /* _BGFX_MATRIX_B2DHOMMATRIX_HXX */
     147                 :            : 
     148                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10