LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/drawinglayer/primitive2d - fillgradientprimitive2d.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-12-27 Functions: 4 4 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_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <drawinglayer/attribute/fillgradientattribute.hxx>
      27             : 
      28             : //////////////////////////////////////////////////////////////////////////////
      29             : // predefines
      30             : 
      31             : namespace basegfx { class B2DPolygon; }
      32             : 
      33             : //////////////////////////////////////////////////////////////////////////////
      34             : // FillGradientPrimitive2D class
      35             : 
      36             : namespace drawinglayer
      37             : {
      38             :     namespace primitive2d
      39             :     {
      40             :         /** FillGradientPrimitive2D class
      41             : 
      42             :             This class defines a gradient filling for a rectangular area. The
      43             :             Range is defined by the Transformation, the gradient by the FillGradientAttribute.
      44             : 
      45             :             The decomposition will deliver the decomposed gradient, e.g. for an ellipse
      46             :             gradient the various ellipses in various color steps will be created.
      47             : 
      48             :             I have added functionality to create both versions of filled decompositions:
      49             :             Those who overlap and non-overlapping ones. The overlapping version is the
      50             :             default one since it works with and without AntiAliasing. The non-overlapping
      51             :             version is used in the MetafilePrimitive2D decomposition when the old XOR
      52             :             paint was recorded.
      53             :          */
      54          54 :         class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
      55             :         {
      56             :         private:
      57             :             /// the geometric definition
      58             :             basegfx::B2DRange                       maObjectRange;
      59             : 
      60             :             /// the gradient definition
      61             :             attribute::FillGradientAttribute        maFillGradient;
      62             : 
      63             :             /// local helpers
      64             :             void generateMatricesAndColors(
      65             :                 std::vector< basegfx::B2DHomMatrix >& rMatrices,
      66             :                 std::vector< basegfx::BColor >& rColors) const;
      67             :             Primitive2DSequence createOverlappingFill(
      68             :                 const std::vector< basegfx::B2DHomMatrix >& rMatrices,
      69             :                 const std::vector< basegfx::BColor >& rColors,
      70             :                 const basegfx::B2DPolygon& rUnitPolygon) const;
      71             :             Primitive2DSequence createNonOverlappingFill(
      72             :                 const std::vector< basegfx::B2DHomMatrix >& rMatrices,
      73             :                 const std::vector< basegfx::BColor >& rColors,
      74             :                 const basegfx::B2DPolygon& rUnitPolygon) const;
      75             : 
      76             :         protected:
      77             :             /// local helper
      78             :             Primitive2DSequence createFill(bool bOverlapping) const;
      79             : 
      80             :             /// local decomposition.
      81             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
      82             : 
      83             :         public:
      84             :             /// constructor
      85             :             FillGradientPrimitive2D(
      86             :                 const basegfx::B2DRange& rObjectRange,
      87             :                 const attribute::FillGradientAttribute& rFillGradient);
      88             : 
      89             :             /// data read access
      90          36 :             const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
      91          27 :             const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
      92             : 
      93             :             /// compare operator
      94             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
      95             : 
      96             :             /// get range
      97             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
      98             : 
      99             :             /// provide unique ID
     100             :             DeclPrimitrive2DIDBlock()
     101             :         };
     102             :     } // end of namespace primitive2d
     103             : } // end of namespace drawinglayer
     104             : 
     105             : //////////////////////////////////////////////////////////////////////////////
     106             : 
     107             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10