LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - fillgradientprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 5 0.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             : #include <drawinglayer/texture/texture.hxx>
      28             : 
      29             : 
      30             : // predefines
      31             : 
      32             : namespace basegfx { class B2DPolygon; }
      33             : 
      34             : 
      35             : // FillGradientPrimitive2D class
      36             : 
      37             : namespace drawinglayer
      38             : {
      39             :     namespace primitive2d
      40             :     {
      41             :         /** FillGradientPrimitive2D class
      42             : 
      43             :             This class defines a gradient filling for a rectangular area. The
      44             :             Range is defined by the Transformation, the gradient by the FillGradientAttribute.
      45             : 
      46             :             The decomposition will deliver the decomposed gradient, e.g. for an ellipse
      47             :             gradient the various ellipses in various color steps will be created.
      48             : 
      49             :             I have added functionality to create both versions of filled decompositions:
      50             :             Those who overlap and non-overlapping ones. The overlapping version is the
      51             :             default one since it works with and without AntiAliasing. The non-overlapping
      52             :             version is used in the MetafilePrimitive2D decomposition when the old XOR
      53             :             paint was recorded.
      54             :          */
      55           0 :         class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
      56             :         {
      57             :         private:
      58             :             /// the geometrically visible area
      59             :             basegfx::B2DRange                       maOutputRange;
      60             : 
      61             :             /// the area the gradient definition is based on
      62             :             /// in the simplest case identical to OutputRange
      63             :             basegfx::B2DRange                       maDefinitionRange;
      64             : 
      65             :             /// the gradient definition
      66             :             attribute::FillGradientAttribute        maFillGradient;
      67             : 
      68             :             /// local helpers
      69             :             void generateMatricesAndColors(
      70             :                 std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
      71             :                 basegfx::BColor& rOuterColor) const;
      72             :             Primitive2DSequence createOverlappingFill(
      73             :                 const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
      74             :                 const basegfx::BColor& rOuterColor,
      75             :                 const basegfx::B2DPolygon& rUnitPolygon) const;
      76             :             Primitive2DSequence createNonOverlappingFill(
      77             :                 const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
      78             :                 const basegfx::BColor& rOuterColor,
      79             :                 const basegfx::B2DPolygon& rUnitPolygon) const;
      80             : 
      81             :         protected:
      82             :             /// local helper
      83             :             Primitive2DSequence createFill(bool bOverlapping) const;
      84             : 
      85             :             /// local decomposition.
      86             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      87             : 
      88             :         public:
      89             :             /// constructors. The one without definition range will use output range as definition range
      90             :             FillGradientPrimitive2D(
      91             :                 const basegfx::B2DRange& rOutputRange,
      92             :                 const attribute::FillGradientAttribute& rFillGradient);
      93             :             FillGradientPrimitive2D(
      94             :                 const basegfx::B2DRange& rOutputRange,
      95             :                 const basegfx::B2DRange& rDefinitionRange,
      96             :                 const attribute::FillGradientAttribute& rFillGradient);
      97             : 
      98             :             /// data read access
      99           0 :             const basegfx::B2DRange& getOutputRange() const { return maOutputRange; }
     100           0 :             const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
     101           0 :             const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
     102             : 
     103             :             /// compare operator
     104             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     105             : 
     106             :             /// get range
     107             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     108             : 
     109             :             /// provide unique ID
     110             :             DeclPrimitive2DIDBlock()
     111             :         };
     112             :     } // end of namespace primitive2d
     113             : } // end of namespace drawinglayer
     114             : 
     115             : 
     116             : 
     117             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10