LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/drawinglayer/texture - texture.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2013-07-09 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
      21             : #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <basegfx/matrix/b2dhommatrix.hxx>
      26             : #include <basegfx/range/b2drange.hxx>
      27             : #include <basegfx/color/bcolor.hxx>
      28             : #include <basegfx/tools/gradienttools.hxx>
      29             : #include <vector>
      30             : 
      31             : //////////////////////////////////////////////////////////////////////////////
      32             : namespace drawinglayer
      33             : {
      34             :     namespace texture
      35             :     {
      36             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvx
      37             :         {
      38             :         public:
      39             :             GeoTexSvx();
      40             :             virtual ~GeoTexSvx();
      41             : 
      42             :             // compare operator
      43             :             virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
      44             :             bool operator!=(const GeoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); }
      45             : 
      46             :             // virtual base methods
      47             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
      48             :             virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
      49             :         };
      50             :     } // end of namespace texture
      51             : } // end of namespace drawinglayer
      52             : 
      53             : //////////////////////////////////////////////////////////////////////////////
      54             : 
      55             : namespace drawinglayer
      56             : {
      57             :     namespace texture
      58             :     {
      59             :         /// helper class for processing equal number of matrices and colors
      60             :         /// for texture processing
      61      349348 :         struct B2DHomMatrixAndBColor
      62             :         {
      63             :             basegfx::B2DHomMatrix   maB2DHomMatrix;
      64             :             basegfx::BColor         maBColor;
      65             :         };
      66             :     } // end of namespace texture
      67             : } // end of namespace drawinglayer
      68             : 
      69             : //////////////////////////////////////////////////////////////////////////////
      70             : 
      71             : namespace drawinglayer
      72             : {
      73             :     namespace texture
      74             :     {
      75             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
      76             :         {
      77             :         protected:
      78             :             basegfx::ODFGradientInfo            maGradientInfo;
      79             :             basegfx::B2DRange                   maTargetRange;
      80             :             basegfx::BColor                     maStart;
      81             :             basegfx::BColor                     maEnd;
      82             :             double                              mfBorder;
      83             : 
      84             :         public:
      85             :             GeoTexSvxGradient(
      86             :                 const basegfx::B2DRange& rTargetRange,
      87             :                 const basegfx::BColor& rStart,
      88             :                 const basegfx::BColor& rEnd,
      89             :                 sal_uInt32 nSteps,
      90             :                 double fBorder);
      91             :             virtual ~GeoTexSvxGradient();
      92             : 
      93             :             // compare operator
      94             :             virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
      95             : 
      96             :             // virtual base methods
      97             :             virtual void appendTransformationsAndColors(
      98             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
      99             :                 basegfx::BColor& rOutmostColor) = 0;
     100             : 
     101             :             // data access
     102             :             const basegfx::BColor& getStart() const { return maStart; }
     103             :             const basegfx::BColor& getEnd() const { return maEnd; }
     104             :         };
     105             :     } // end of namespace texture
     106             : } // end of namespace drawinglayer
     107             : 
     108             : //////////////////////////////////////////////////////////////////////////////
     109             : 
     110             : namespace drawinglayer
     111             : {
     112             :     namespace texture
     113             :     {
     114             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
     115             :         {
     116             :         public:
     117             :             GeoTexSvxGradientLinear(
     118             :                 const basegfx::B2DRange& rTargetRange,
     119             :                 const basegfx::BColor& rStart,
     120             :                 const basegfx::BColor& rEnd,
     121             :                 sal_uInt32 nSteps,
     122             :                 double fBorder,
     123             :                 double fAngle);
     124             :             virtual ~GeoTexSvxGradientLinear();
     125             : 
     126             :             virtual void appendTransformationsAndColors(
     127             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     128             :                 basegfx::BColor& rOutmostColor);
     129             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     130             :         };
     131             :     } // end of namespace texture
     132             : } // end of namespace drawinglayer
     133             : 
     134             : //////////////////////////////////////////////////////////////////////////////
     135             : 
     136             : namespace drawinglayer
     137             : {
     138             :     namespace texture
     139             :     {
     140             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
     141             :         {
     142             :         public:
     143             :             GeoTexSvxGradientAxial(
     144             :                 const basegfx::B2DRange& rTargetRange,
     145             :                 const basegfx::BColor& rStart,
     146             :                 const basegfx::BColor& rEnd,
     147             :                 sal_uInt32 nSteps,
     148             :                 double fBorder,
     149             :                 double fAngle);
     150             :             virtual ~GeoTexSvxGradientAxial();
     151             : 
     152             :             virtual void appendTransformationsAndColors(
     153             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     154             :                 basegfx::BColor& rOutmostColor);
     155             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     156             :         };
     157             :     } // end of namespace texture
     158             : } // end of namespace drawinglayer
     159             : 
     160             : //////////////////////////////////////////////////////////////////////////////
     161             : 
     162             : namespace drawinglayer
     163             : {
     164             :     namespace texture
     165             :     {
     166             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : public GeoTexSvxGradient
     167             :         {
     168             :         public:
     169             :             GeoTexSvxGradientRadial(
     170             :                 const basegfx::B2DRange& rTargetRange,
     171             :                 const basegfx::BColor& rStart,
     172             :                 const basegfx::BColor& rEnd,
     173             :                 sal_uInt32 nSteps,
     174             :                 double fBorder,
     175             :                 double fOffsetX,
     176             :                 double fOffsetY);
     177             :             virtual ~GeoTexSvxGradientRadial();
     178             : 
     179             :             virtual void appendTransformationsAndColors(
     180             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     181             :                 basegfx::BColor& rOutmostColor);
     182             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     183             :         };
     184             :     } // end of namespace texture
     185             : } // end of namespace drawinglayer
     186             : 
     187             : //////////////////////////////////////////////////////////////////////////////
     188             : 
     189             : namespace drawinglayer
     190             : {
     191             :     namespace texture
     192             :     {
     193             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
     194             :         {
     195             :         public:
     196             :             GeoTexSvxGradientElliptical(
     197             :                 const basegfx::B2DRange& rTargetRange,
     198             :                 const basegfx::BColor& rStart,
     199             :                 const basegfx::BColor& rEnd,
     200             :                 sal_uInt32 nSteps,
     201             :                 double fBorder,
     202             :                 double fOffsetX,
     203             :                 double fOffsetY,
     204             :                 double fAngle);
     205             :             virtual ~GeoTexSvxGradientElliptical();
     206             : 
     207             :             virtual void appendTransformationsAndColors(
     208             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     209             :                 basegfx::BColor& rOutmostColor);
     210             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     211             :         };
     212             :     } // end of namespace texture
     213             : } // end of namespace drawinglayer
     214             : 
     215             : //////////////////////////////////////////////////////////////////////////////
     216             : 
     217             : namespace drawinglayer
     218             : {
     219             :     namespace texture
     220             :     {
     221             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
     222             :         {
     223             :         public:
     224             :             GeoTexSvxGradientSquare(
     225             :                 const basegfx::B2DRange& rTargetRange,
     226             :                 const basegfx::BColor& rStart,
     227             :                 const basegfx::BColor& rEnd,
     228             :                 sal_uInt32 nSteps,
     229             :                 double fBorder,
     230             :                 double fOffsetX,
     231             :                 double fOffsetY,
     232             :                 double fAngle);
     233             :             virtual ~GeoTexSvxGradientSquare();
     234             : 
     235             :             virtual void appendTransformationsAndColors(
     236             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     237             :                 basegfx::BColor& rOutmostColor);
     238             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     239             :         };
     240             :     } // end of namespace texture
     241             : } // end of namespace drawinglayer
     242             : 
     243             : //////////////////////////////////////////////////////////////////////////////
     244             : 
     245             : namespace drawinglayer
     246             : {
     247             :     namespace texture
     248             :     {
     249             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
     250             :         {
     251             :         public:
     252             :             GeoTexSvxGradientRect(
     253             :                 const basegfx::B2DRange& rTargetRange,
     254             :                 const basegfx::BColor& rStart,
     255             :                 const basegfx::BColor& rEnd,
     256             :                 sal_uInt32 nSteps,
     257             :                 double fBorder,
     258             :                 double fOffsetX,
     259             :                 double fOffsetY,
     260             :                 double fAngle);
     261             :             virtual ~GeoTexSvxGradientRect();
     262             : 
     263             :             virtual void appendTransformationsAndColors(
     264             :                 std::vector< B2DHomMatrixAndBColor >& rEntries,
     265             :                 basegfx::BColor& rOutmostColor);
     266             :             virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
     267             :         };
     268             :     } // end of namespace texture
     269             : } // end of namespace drawinglayer
     270             : 
     271             : //////////////////////////////////////////////////////////////////////////////
     272             : 
     273             : namespace drawinglayer
     274             : {
     275             :     namespace texture
     276             :     {
     277             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch : public GeoTexSvx
     278             :         {
     279             :         protected:
     280             :             basegfx::B2DHomMatrix               maTextureTransform;
     281             :             basegfx::B2DHomMatrix               maBackTextureTransform;
     282             :             double                              mfDistance;
     283             :             double                              mfAngle;
     284             :             sal_uInt32                          mnSteps;
     285             : 
     286             :         public:
     287             :             GeoTexSvxHatch(
     288             :                 const basegfx::B2DRange& rTargetRange,
     289             :                 double fDistance,
     290             :                 double fAngle);
     291             :             virtual ~GeoTexSvxHatch();
     292             : 
     293             :             // compare operator
     294             :             virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
     295             : 
     296             :             virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
     297             :             double getDistanceToHatch(const basegfx::B2DPoint& rUV) const;
     298             :             const basegfx::B2DHomMatrix& getBackTextureTransform() const;
     299             :         };
     300             :     } // end of namespace texture
     301             : } // end of namespace drawinglayer
     302             : 
     303             : //////////////////////////////////////////////////////////////////////////////
     304             : 
     305             : namespace drawinglayer
     306             : {
     307             :     namespace texture
     308             :     {
     309             :         // This class applies a tiling to the unit range. The given range
     310             :         // will be repeated inside the unit range in X and Y and for each
     311             :         // tile a matrix will be created (by appendTransformations) that
     312             :         // represents the needed transformation to map a filling in unit
     313             :         // coordinates to that tile.
     314             :         // When offsetX is given, every 2nd line will be ofsetted by the
     315             :         // given percentage value (offsetX has to be 0.0 <= offsetX <= 1.0).
     316             :         // Accordingly to offsetY. If both are given, offsetX is preferred
     317             :         // and offsetY is ignored.
     318             :         class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled : public GeoTexSvx
     319             :         {
     320             :         protected:
     321             :             basegfx::B2DRange               maRange;
     322             :             double                          mfOffsetX;
     323             :             double                          mfOffsetY;
     324             : 
     325             :         public:
     326             :             GeoTexSvxTiled(
     327             :                 const basegfx::B2DRange& rRange,
     328             :                 double fOffsetX = 0.0,
     329             :                 double fOffsetY = 0.0);
     330             :             virtual ~GeoTexSvxTiled();
     331             : 
     332             :             // compare operator
     333             :             virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
     334             : 
     335             :             virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
     336             :         };
     337             :     } // end of namespace texture
     338             : } // end of namespace drawinglayer
     339             : 
     340             : //////////////////////////////////////////////////////////////////////////////
     341             : 
     342             : #endif //_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
     343             : 
     344             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10